1、安装网络插件报错
Warning FailedCreatePodSandBox 7m52s kubelet Failed to create pod sandbox: rpc error: code = Unknown desc = failed to set up sandbox container "abef835314ad175e12170af25ddc0603962e94d6818e71dd52c532c601fcfa8e" network for pod "coredns-6c76c8bb89-6krhq": networkPlugin cni failed to set up pod "coredns-6c76c8bb89-6krhq_kube-system" network: stat /var/lib/calico/nodename: no such file or directory: check that the calico/node container is running and has mounted /var/lib/calico/问题原因:因为之前安装了calico网络插件未成功,导致calico配置残留的问题,然后找到相关的calico文件删除掉问题就解决了
连接Node节点,使用以下命令删除node节点上关于calico的配置信息,并重启kubelet服务 rm -rf /etc/cni/net.d/* rm -rf /var/lib/cni/calico systemctl restart kubelet kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml
2、networkPlugin cni failed to set up pod “coredns-9d85f5447-2j4t8_kube-system” network: open /run/flannel/subnet.env: no such file or directory
查看指定路径下是否存在subnet.env文件 cat /run/flannel/subnet.env的内容: FLANNEL_NETWORK=10.244.0.0/16 FLANNEL_SUBNET=10.224.0.1/24 FLANNEL_MTU=1450 FLANNEL_IPMASQ=true 注:10.224.0.1 这个IP地址在初始化文件的时候指定 cat kubeadm-config.yaml apiVersion: kubeadm.k8s.io/v1beta3 bootstrapTokens: - groups: - system:bootstrappers:kubeadm:default-node-token token: abcdef.0123456789abcdef ttl: 24h0m0s usages: - signing - authentication kind: InitConfiguration localAPIEndpoint: advertiseAddress: 10.0.2.4 bindPort: 6443 nodeRegistration: criSocket: /var/run/dockershim.sock imagePullPolicy: IfNotPresent name: master-2-4 taints: null --- apiServer: timeoutForControlPlane: 4m0s apiVersion: kubeadm.k8s.io/v1beta3 certificatesDir: /etc/kubernetes/pki clusterName: kubernetes controllerManager: {} dns: {} etcd: local: dataDir: /var/lib/etcd imageRepository: registry.cn-hangzhou.aliyuncs.com/google_containers kind: ClusterConfiguration kubernetesVersion: 1.22.0 networking: dnsDomain: cluster.local podSubnet: "10.244.0.0/16" #这里的IP地址 serviceSubnet: 10.96.0.0/12 scheduler: {}
3、Kubernetes的从节点上运行 kubectl get nodes 命令出现了如下错误
The connection to the server localhost:8080 was refused - did you specify the right host or port?解决方法: 出现这个问题的原因是kubectl命令需要使用kubernetes-admin来运行,解决方法如下,将主节点中的【/etc/kubernetes/admin.conf】文件拷贝到从节点相同目录下,然后配置环境变量:
echo "export KUBECONFIG=/etc/kubernetes/admin.conf" >> ~/.bash_profile source ~/.bash_profile
4、将node节点加入kubernetes集群中roles名称不显示
[root@node1-2-5 ~]# kubectl get nodes NAME STATUS ROLES AGE VERSION master-2-4 Ready control-plane,master 53m v1.22.6 node1-2-5 Ready <none> 7m44s v1.22.6 node2-2-6 Ready <none> 7m39s v1.22.6解决方法:
kubectl label no node2-2-6 kubernetes.io/role=node #node2-2-6 是node节点的hostname
5、初始化集群的时候报错
[ERROR Swap]: running with swap on is not supported. Please disable swap原因:忘记关闭交换分区的使用,导致这里报错 解决方法:
swapoff -a
6、node节点显示not ready
Container runtime network not ready: NetworkReady=false reason:NetworkPluginNotReady message:docker:解决办法 将master节点/opt/cni/bin 的文件拷贝到not ready 节点上去 标签:node,kubernetes,部署,节点,报错,calico,cni From: https://www.cnblogs.com/shuiyuesheng/p/17014713.html