1、执行kubectl命令报错error: no configuration has been provided, try setting KUBERNETES_MASTER environment variable
解决方法:
在/etc/profile末尾增加 export KUBECONFIG=/etc/kubernetes/admin.conf source /etc/profile
2、报错coredns容器的状态是pending
解决方法:
可能是因为master上的flannel镜像拉取失败,导致获取不到解析的IP
3、coredns容器log日子报错networkPlugin cni failed to set up pod "coredns-7ff77c879f-5shql_kube-system" network: open /run/flannel/subnet.env: no such file or directory
解决方法:
查看是否有 /run/flannel/subnet.env 这个文件,master 上是存在的,也有内容 没有就创建一个 FLANNEL_NETWORK=10.244.0.0/16 FLANNEL_SUBNET=10.244.0.1/24 FLANNEL_MTU=1450 FLANNEL_IPMASQ=true
4、网络插件flannel容器状态为Init:ImagePullBackOff
解决办法:
查看kube-flannel.yml文件时发现quay.io/coreos/flannel:v0.12.0-amd64
quay.io网站目前国内无法访问
5、网络插件flannel容器的logs日志报错Error registering network: failed to acquire lease: node "ha01" pod cidr not assigned
解决方法:
1.通过命令安装Kubeadm Init的时候,没有增加 --pod-network-cidr 10.244.0.0/16参数 注意,安装Flannel时,kube-flannel.yml如果yml中的"Network": "10.244.0.0/16"和--pod-network-cidr不一样,就修改成一样的。不然可能会使得Node间Cluster IP不通。 2.如果通过yml文件安装必须加上 networking: dnsDomain: cluster.local podSubnet: "10.244.0.0/16" serviceSubnet: 10.96.0.0/12
原文:https://www.cnblogs.com/syjr/p/14270854.html