Joining an additional control plane node to an existing Kubernetes cluster

Joining an additional control plane node to an existing Kubernetes cluster involves specific steps to ensure proper synchronization between the control plane components. Below is the detailed process:


1. Pre-Requisites

Ensure the following on the new control plane node:

  • Same Kubernetes Version: The new node must have the same Kubernetes version installed as the existing control plane.
    kubeadm version
    
  • Kubeadm, Kubelet, and Kubectl Installed: Ensure these tools are installed and configured.
  • Network Configuration: The new control plane must have network connectivity to the existing control plane nodes.

2. Retrieve the Join Command

On an existing control plane node, generate the kubeadm join command with the --control-plane flag:

kubeadm token create --print-join-command

You will get output similar to:

kubeadm join <control-plane-endpoint>:6443 --token <token> \
    --discovery-token-ca-cert-hash sha256:<hash> \
    --control-plane

3. Copy Certificates to the New Control Plane

The new control plane requires the certificates from the existing control plane. This can be done in two ways:

Option A: Automate with --certificate-key

  1. Generate a certificate key on the existing control plane:

    kubeadm init phase upload-certs --upload-certs
    

    The command outputs a key like:

    Certificate key: abc123abc123abc123abc123abc123abc123abc123abc123abc123abc123abc12
    
  2. Use the --certificate-key in the join command:

    kubeadm join <control-plane-endpoint>:6443 --token <token> \
        --discovery-token-ca-cert-hash sha256:<hash> \
        --control-plane --certificate-key <certificate-key>
    

Option B: Manually Copy Certificates

If --certificate-key isn't used, manually copy the certificate files from an existing control plane node:

  1. Copy the /etc/kubernetes/pki directory (except etcd/ unless etcd is running externally) to the new node:
    scp -r /etc/kubernetes/pki <new-control-plane-ip>:/etc/kubernetes/
    scp /etc/kubernetes/admin.conf <new-control-plane-ip>:/etc/kubernetes/
    

4. Run the Join Command on the New Node

Run the kubeadm join command with the appropriate options:

kubeadm join <control-plane-endpoint>:6443 --token <token> \
    --discovery-token-ca-cert-hash sha256:<hash> \
    --control-plane

5. Verify the New Control Plane Node

  1. Check the status of the nodes in the cluster:

    kubectl get nodes
    

    The new control plane node should appear as Ready.

  2. Check the pods running on the new control plane:

    kubectl get pods -n kube-system -o wide
    

    Ensure critical components (e.g., kube-apiserver, kube-scheduler, kube-controller-manager) are running.

  3. Verify the etcd cluster:

    kubectl exec -n kube-system <etcd-pod-name> -- etcdctl member list
    

    Replace <etcd-pod-name> with the name of the etcd pod.


6. Troubleshooting

  • Check Logs: If the join command fails, examine the logs on the new node:
    journalctl -u kubelet -f
    
  • Verify Certificates: Ensure the /etc/kubernetes/pki directory is correctly populated on the new node.
  • ControlPlaneEndpoint: If a load balancer isn't used, ensure the --control-plane-endpoint points to an active control plane node.

Let me know if you encounter specific issues or errors during the process!

댓글

이 블로그의 인기 게시물

Using the MinIO API via curl

How to split a list into chunks of 100 items in JavaScript, 자바스크립트 리스트 쪼개기

HTML Inline divisions at one row by Tailwind

Boilerplate for typescript server programing

가속도 & 속도

Gradle multi-module project

How to checkout branch of remote git, 깃 리모트 브랜치 체크아웃

CDPEvents in puppeteer

Sparse encoder

Reactjs datetime range picker