Preview Question 3

Step 1: Create the Pod and Service

To begin, create a Pod named check-ip in the default namespace and expose it via a ClusterIP Service:

Step 2: Retrieve the IP of the Service

Retrieve the ClusterIP of the check-ip-service to check its initial configuration:

Step 3: Change the Service CIDR

To change the Service CIDR for the cluster, follow these steps:

SSH into the control plane node:

Edit the kube-apiserver manifest to update the --service-cluster-ip-range parameter:

Change the line to:

Save the file and wait for the kube-apiserver to restart.

Similarly, update the kube-controller-manager manifest:

Change the line to:

Save the file and wait for the kube-controller-manager to restart.

Step 4: Verify the Change

Create a second Service pointing to the same Pod:

Verify the IP address of both services:

Expected Results

Service 1 (check-ip-service) should retain its original IP.

Service 2 (check-ip-service2) should have an IP from the new CIDR range (11.96.0.0/12).

Conclusion

This process demonstrates how to change the Service CIDR in a Kubernetes cluster and verify the changes by creating new services to see the updated IP ranges.

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 *