kuberenetes 升级后新加入节点报错

栏目: 编程工具 · 发布时间: 6年前

内容简介:原本用在master节点上执行步骤1-4,在从节点(将要加入集群的机器)上执行步骤5从现有角色绑定 “kubeadm:kubelet-config-1.11” 创建一个新角色绑定 “kubeadm:kubelet-config-1.12”

原本用 kubeadm 安装的的kubernetes 1.11.x集群升级到1.12.x 后(使用 kubeadm upgrade 升级)发现无法将新的node加入到集群中,会出现以下报错信息

[preflight] running pre-flight checks
    [WARNING RequiredIPVSKernelModulesAvailable]: the IPVS proxier will not be used, because the following required kernel modules are not loaded: [ip_vs_sh ip_vs ip_vs_rr ip_vs_wrr] or no builtin kernel ipvs support: map[ip_vs_rr:{} ip_vs_wrr:{} ip_vs_sh:{} nf_conntrack_ipv4:{} ip_vs:{}]
you can solve this problem with following methods:
 1. Run 'modprobe -- ' to load missing kernel modules;
2. Provide the missing builtin kernel ipvs support

[discovery] Trying to connect to API Server "172.19.170.254:6443"
[discovery] Created cluster-info discovery client, requesting info from "https://172.19.170.254:6443"
[discovery] Requesting info from "https://172.19.170.254:6443" again to validate TLS against the pinned public key
[discovery] Cluster info signature and contents are valid and TLS certificate validates against pinned roots, will use API Server "172.19.170.254:6443"
[discovery] Successfully established connection with API Server "172.19.170.254:6443"
[kubelet] Downloading configuration for the kubelet from the "kubelet-config-1.12" ConfigMap in the kube-system namespace
configmaps "kubelet-config-1.12" is forbidden: User "system:bootstrap:y1zgt7" cannot get configmaps in the namespace "kube-system"

修复方法

在master节点上执行步骤1-4,在从节点(将要加入集群的机器)上执行步骤5

步骤一

从现有的”ConfigMap kubelet-config-1.11” 创建一个新的ConfigMap “kubelet-config-1.12”

$ kubectl get cm --all-namespaces
$ kubectl -n kube-system get cm kubelet-config-1.11 -o yaml --export > kubelet-config-1.12-cm.yaml
$ vim kubelet-config-1.12-cm.yaml       #modify at the bottom:
                                        #name: kubelet-config-1.12
                                        #delete selfLink
$ kubectl -n kube-system create -f kubelet-config-1.12-cm.yaml

步骤二:获取令牌前缀

$ kubeadm token list           #if no output, then create a token:
$ kubeadm token create
TOKEN                       ...     ...
a0b1c2.svn4my9ifft4zxgg     ...     ...
# Token prefix is "a0b1c2"

步骤三

从现有角色“kubeadm:kubelet-config-1.11”创建一个新角色“kubeadm:kubelet-config-1.12”

$ kubectl get roles --all-namespaces
$ kubectl -n kube-system get role kubeadm:kubelet-config-1.11 -o yaml > kubeadm:kubelet-config-1.12-role.yaml
$ vim kubeadm\:kubelet-config-1.12-role.yaml    #modify the following:
                                                #name: kubeadm:kubelet-config-1.12
                                                #resourceNames: kubelet-config-1.12
                                                #delete creationTimestamp, resourceVersion, selfLink, uid (because --export option is not supported)    
$ kubectl -n kube-system create -f kubeadm\:kubelet-config-1.12-role.yaml

步骤四

从现有角色绑定 “kubeadm:kubelet-config-1.11” 创建一个新角色绑定 “kubeadm:kubelet-config-1.12”

$ kubectl get rolebindings --all-namespaces
$ kubectl -n kube-system get rolebinding kubeadm:kubelet-config-1.11 -o yaml > kubeadm:kubelet-config-1.12-rolebinding.yaml
$ vim kubeadm\:kubelet-config-1.12-rolebinding.yaml     #modify the following:
                                                            #metadata/name: kubeadm:kubelet-config-1.12
                                                            #roleRef/name: kubeadm:kubelet-config-1.12
                                                            #delete creationTimestamp, resourceVersion, selfLink, uid (because --export option is not supported)
- apiGroup: rbac.authorization.k8s.io                       #add these 3 lines as another group in "subjects:" at the bottom, with the 6 character token prefix from STEP 2
  kind: Group
  name: system:bootstrap:a0b1c2 
$ kubectl -n kube-system create -f kubeadm\:kubelet-config-1.12-rolebinding.yaml

步骤5:从工作节点启动kubeadm join

$ sudo kubeadm join --token <token> <master-IP>:6443 --discovery-token-ca-cert-hash sha256:<key-value> 
# If you receive 2 ERRORS, run kubeadm join again with the following options:
$ sudo kubeadm join --token <token> <master-IP>:6443 --discovery-token-ca-cert-hash sha256:<key-value> --ignore-preflight-errors=FileAvailable--etc-kubernetes-bootstrap-kubelet.conf,FileAvailable--etc-kubernetes-pki-ca.crt

以上所述就是小编给大家介绍的《kuberenetes 升级后新加入节点报错》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

Data Structures and Algorithm Analysis in Java

Data Structures and Algorithm Analysis in Java

Mark A. Weiss / Pearson / 2006-3-3 / USD 143.00

As the speed and power of computers increases, so does the need for effective programming and algorithm analysis. By approaching these skills in tandem, Mark Allen Weiss teaches readers to develop wel......一起来看看 《Data Structures and Algorithm Analysis in Java》 这本书的介绍吧!

HTML 压缩/解压工具
HTML 压缩/解压工具

在线压缩/解压 HTML 代码

在线进制转换器
在线进制转换器

各进制数互转换器

RGB CMYK 转换工具
RGB CMYK 转换工具

RGB CMYK 互转工具