K8s – Question14

Use context: kubectl config use-context k8s-c1-H

You’re ask to find out following information about the cluster k8s-c1-H :

  1. How many controlplane nodes are available?
  2. How many worker nodes are available?
  3. What is the Service CIDR?
  4. Which Networking (or CNI Plugin) is configured and where is its config file?
  5. Which suffix will static pods have that run on cluster1-node1?

Write your answers into file /opt/course/14/cluster-info, structured like this:

Gathering Essential Kubernetes Cluster Information

Understanding the configuration and setup of your Kubernetes cluster is crucial for effective management and troubleshooting. In this guide, we’ll walk through how to gather key pieces of information about a Kubernetes cluster, including the number of control plane and worker nodes, the Service CIDR, the configured CNI plugin, and the naming convention for static pods.

Step 1: Checking the Number of Control Plane and Worker Nodes

First, let’s determine how many control plane and worker nodes are available in the cluster. You can retrieve this information using the following command:

Here’s an example output:

From this output, we can see that there is one control plane node and two worker nodes in the cluster.

Step 2: Finding the Service CIDR

The Service CIDR is the range of IP addresses assigned to Kubernetes services. To find this information, SSH into the control plane node and check the kube-apiserver configuration:

Once connected, run the following command to inspect the kube-apiserver manifest:

The output will look something like this:

This indicates that the Service CIDR for this cluster is 10.96.0.0/12.

Step 3: Identifying the Configured CNI Plugin

Kubernetes uses a Container Network Interface (CNI) plugin to manage networking within the cluster. To identify which CNI plugin is configured and locate its configuration file, run the following commands:

Here’s an example of what you might find:

This output shows that the Weave CNI plugin is configured, and its configuration file is located at /etc/cni/net.d/10-weave.conflist.

Step 4: Understanding Static Pod Naming Convention

Static pods running on a specific node have a unique suffix based on the node’s hostname. The naming convention for these pods follows the pattern: -. For example, static pods running on cluster1-node1 would have the suffix -cluster1-node1.

Cluster Information Summary

After gathering all the relevant information, you can summarize it as follows:

This information is crucial for understanding your Kubernetes cluster’s architecture and for performing effective troubleshooting and management tasks.

Conclusion

By following the steps in this guide, you’ve gathered essential information about your Kubernetes cluster, including node roles, the Service CIDR, the configured CNI plugin, and static pod naming conventions. These details form the foundation for managing and scaling your Kubernetes environment efficiently.

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 *