1. 安装网络插件Calico:

         此处我设置的pod的网络地址段为172.31.0.0/16, 而calico.yml中默认的网络地址段是192.168.0.0/16, 此处一定要修改为自己之前设置的pod-network-cidr

kubeadm init \
--apiserver-advertise-address=192.168.2.2 \
--control-plane-endpoint=cluster-endpoint \
--image-repository registry.cn-hangzhou.aliyuncs.com/lfy_k8s_images \
--kubernetes-version v1.20.9 \
--service-cidr=10.96.0.0/16 \
--pod-network-cidr=172.31.0.0/16

 # The default IPv4 pool to create on startup if none exists. Pod IPs will be
 # chosen from this range. Changing this value after installation will have
 # no effect. This should fall within `--cluster-cidr`.
 - name: CALICO_IPV4POOL_CIDR
   value: "172.31.0.0/16"
           

2. 将worker nodes加入到K8S集群中时,有一个node一直出现拉取镜像失败,经过多次定位最后发现是当前worker node没有配置DNS服务器,使得无法解析公网域名的地址,

    解决办法 => 在问题节点上配置/etc/resolv.conf

# Generated by NetworkManager
nameserver 8.8.8.8
nameserver 114.114.114.114
Logo

K8S/Kubernetes社区为您提供最前沿的新闻资讯和知识内容

更多推荐