Add/Remove node to Kubernetes cluster

Source: Internet
Author: User

Add/Remove node to Kubernetes cluster

  1. Minion node pre-operation preparation
    #关闭防火墙systemctl stop firewalld#禁止防火墙开机启动systemctl disable firewalld#检查selinuxgetenforceDisabled#端口检查
  2. Add node to the Kubernetes cluster
    When the KUBEADM Init initialization operation is complete, the system finally gives the command to join the node to the cluster:
    kubeadm join 10.0.0.39:6443 --token 4g0p8w.w5p29ukwvitim2ti --discovery-token-ca-cert-hash sha256:21d0adbfcb409dca97e655641573b2ee51c77a212f194e20a307cb459e5f77c8

    Note: This command must be kept good, because the late can not reproduce!!
    Operation on Swarm1 (Minion Node):

    kubeadm join 10.0.0.39:6443 --token 4g0p8w.w5p29ukwvitim2ti --discovery-token-ca-cert-hash sha256:21d0adbfcb409dca97e655641573b2ee51c77a212f194e20a307cb459e5f77c8

    To operate on Swarm2 (Master):

    kubectl get nodesNAME      STATUS    ROLES     AGE       VERSIONswarm1    Ready     <none>    3h        v1.10.0swarm2    Ready     master    3h        v1.10.0

    Swarm1 join the cluster is very smooth!

  3. Removing node from the Kubernetes cluster
    Execute on the master node:
    kubectl drain swarm1 --delete-local-data --force --ignore-daemonsetskubectl delete node swarm1

    Execute on Node2:

    kubeadm reset
  4. Add a problem with node
    #Minion node has been in Notready state, such as:
    kubectl get nodesNAME      STATUS     ROLES     AGE       VERSIONswarm1    NotReady   <none>    3h        v1.10.0swarm2    Ready      master    3h        v1.10.0

    #原因
    (1) Start Kubelet, will pull the following two mirrors (gcr.io/**), because the celestial network generally can not turn the wall, can not pull successfully, so you have to find the two Docker image. Click images to download it yourself!

    k8s.gcr.io/kube-proxy-amd64   v1.10.1             6e6237849607        3 weeks ago         97.1 MBk8s.gcr.io/pause-amd64        3.1                 da86e6ba6ca1        4 months ago        742 kB

    (2) The Kubernetes cluster, which is built using the Kubeadm tool, has been integrated with the security policy by default, so all files under the master node node/etc/kubernetes/pki are copied to the next copy of the Minion node directory. So on master node, execute:

    scp /etc/kubernetes/pki/* [email protected]{minion-ip}:/etc/kubernetes/pki

Add/Remove node to Kubernetes cluster

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.