使用kubeadm部署k8s集群06-扩容kube-controller-manager到3节点

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了使用kubeadm部署k8s集群06-扩容kube-controller-manager到3节点相关的知识,希望对你有一定的参考价值。

使用kubeadm部署k8s集群06-扩容kube-controller-manager到3节点

2018/1/3

扩容 kube-controller-manager 到 3 节点

  • 连接到本节点的 apiserver
    
    [[email protected] ~]# cat /etc/kubernetes/manifests/kube-controller-manager.yaml |grep ‘/etc/kubernetes‘
  • --kubeconfig=/etc/kubernetes/controller-manager.conf
  • --root-ca-file=/etc/kubernetes/pki/ca.crt
  • --service-account-private-key-file=/etc/kubernetes/pki/sa.key
  • --cluster-signing-cert-file=/etc/kubernetes/pki/ca.crt
  • --cluster-signing-key-file=/etc/kubernetes/pki/ca.key
  • mountPath: /etc/kubernetes/pki
  • mountPath: /etc/kubernetes/controller-manager.conf
    path: /etc/kubernetes/pki
    path: /etc/kubernetes/controller-manager.conf

显然,我们需要 2 个配置文件:

/etc/kubernetes/controller-manager.conf
/etc/kubernetes/manifests/kube-controller-manager.yaml

查看文件内容发现,只有一个配置需要更改 IP 地址指向对应的 apiserver 地址:

/etc/kubernetes/controller-manager.conf

[[email protected] ~]# mkdir ~/k8s_install/master/kube-controller-manager
[[email protected] ~]# cd !$

修改配置:

[[email protected] kube-controller-manager]# cp -a /etc/kubernetes/controller-manager.conf tvm-01.controller-manager.conf
[[email protected] kube-controller-manager]# sed -i ‘s#10.10.9.67:6443#10.10.9.68:6443#‘ tvm-01.controller-manager.conf

同步配置到目标节点来启动服务:

[[email protected] kube-controller-manager]# scp tvm-01.controller-manager.conf 10.10.9.68:/etc/kubernetes/controller-manager.conf
[[email protected] kube-controller-manager]# scp /etc/kubernetes/manifests/kube-controller-manager.yaml 10.10.9.68:/etc/kubernetes/manifests/

检查是否有异常:

[[email protected] ~]# kubectl get pods --all-namespaces |grep ‘kube-controller-manager-tvm‘
[[email protected] ~]# kubectl logs --tail=20 -n kube-system kube-controller-manager-tvm-01

在另一个节点操作:

修改配置:

[[email protected] kube-controller-manager]# cp -a /etc/kubernetes/controller-manager.conf tvm-02.controller-manager.conf
[[email protected] kube-controller-manager]# sed -i ‘s#10.10.9.67:6443#10.10.9.69:6443#‘ tvm-02.controller-manager.conf

同步配置到目标节点来启动服务:

[[email protected] kube-controller-manager]# scp tvm-02.controller-manager.conf 10.10.9.69:/etc/kubernetes/controller-manager.conf
[[email protected] kube-controller-manager]# scp /etc/kubernetes/manifests/kube-controller-manager.yaml 10.10.9.69:/etc/kubernetes/manifests/

以上是关于使用kubeadm部署k8s集群06-扩容kube-controller-manager到3节点的主要内容,如果未能解决你的问题,请参考以下文章

使用kubeadm部署k8s集群05-配置kubectl访问kube-apiserver

使用kubeadm部署k8s集群04-配置kubelet访问kube-apiserver

使用kubeadm部署k8s集群08-配置LB指向kube-apiserver

使用kube-vip部署高可用K8S集群

kubeadm部署高可用K8S集群(v1.14.0)

使用kubeadm部署k8s集群02-配置etcd高可用