K8s – Question20

Use context: kubectl config use-context k8s-c3-CCC

Your coworker said node cluster3-node2 is running an older Kubernetes version and is not even part of the cluster. Update Kubernetes on that node to the exact version that’s running on cluster3-controlplane1. Then add this node to the cluster. Use kubeadm for this.

Upgrading Kubernetes and Adding a Node to Your Cluster

Upgrading your Kubernetes cluster and adding new nodes are essential tasks for maintaining a healthy and scalable environment. In this guide, we’ll walk through upgrading Kubernetes on a control plane node and adding a new node to your cluster using kubeadm.

Step 1: Checking the Current Kubernetes Version

Before starting the upgrade, it’s important to verify the current version of Kubernetes running on your nodes. Run the following command to check the version:

Example output:

Here, we see that both nodes are running Kubernetes version v1.30.1.

Step 2: Preparing the Node for Upgrade

Next, SSH into the node that needs to be upgraded. In this example, we’ll work with cluster3-node2:

Check the versions of kubeadm, kubectl, and kubelet installed on the node:

If the tools are outdated, upgrade them by running:

After upgrading, restart the kubelet service:

Step 3: Adding the Node to the Cluster

To add cluster3-node2 to the cluster, we need to generate a join command from the control plane node. SSH into the control plane node:

Generate a TLS bootstrap token and the join command:

This command will output something like this:

Now, return to cluster3-node2 and execute the join command:

This will join the node to the cluster, and you should see confirmation that the node has successfully joined.

Step 4: Verifying the Node Status

Finally, check the status of the node by running kubectl get nodes from the control plane:

After a short time, the node should appear as Ready:

This indicates that cluster3-node2 is now successfully part of the Kubernetes cluster and running the upgraded version of Kubernetes.

Conclusion

In this guide, we covered how to upgrade Kubernetes on a control plane node and add a new node to the cluster. Keeping your cluster up to date ensures compatibility with new features, improved security, and better overall performance. By following these steps, you can maintain a robust and scalable Kubernetes environment.

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply

Your email address will not be published. Required fields are marked *