Kubernetes 安装问题解决

CoreDNS状态为 0/1

kubectl delete pod -n kube-system + corednsID

可能自动重建解决,也可能不会

检查结果

kubectl get pod --all-namespaces -o wide 

CoreDNS挂载在Node而非Master,见下

Master

重置并初始化
kubeadm reset
kubectl delete -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml

注意使用自己宿主机的IP

kubeadm init --apiserver-advertise-address=192.168.100.100 --image-repository registry.aliyuncs.com/google_containers --kubernetes-version=v1.17.4 --pod-network-cidr=172.168.1.0/16 --service-cidr=10.96.0.0/12 
 mkdir -p $HOME/.kube
 sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
 sudo chown $(id -u):$(id -g) $HOME/.kube/config
wget https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml
kubectl apply -f kube-flannel.yml

Node

kubeadm reset
清理Flannel
ifconfig cni0 down
ip link delete cni0
ifconfig flannel.1 down
ip link delete flannel.1
rm -rf /var/lib/cni/
rm -f /etc/cni/net.d/*
重启
systemctl daemon-reload
重新加入
kubeadm join 192.168.100.100:6443 --token boiwox.cb2561zo1t0lp3p6     --discovery-token-ca-cert-hash sha256:d1c844d36e098e2d2264bb40d5a566a0010de136a4c0a08d55658fb0c0e5cf05
kubectl get pod -A
上一篇:k8s简介


下一篇:k8s安全测试工具kube-hunter