How to change the Kubernetes Service Network CIDR Range of your existing TKGI cluster using k8s profiles
search cancel

How to change the Kubernetes Service Network CIDR Range of your existing TKGI cluster using k8s profiles

book

Article ID: 298628

calendar_today

Updated On:

Products

VMware Tanzu Kubernetes Grid Integrated Edition

Issue/Introduction

In the TKGI tile, the option is available to configure the Kubernetes Service Network CIDR Range.



If you wish to later update this range, for example to increase the number of IP addresses available for services, you can change the range and Apply Changes. Any new clusters will have this new range for their services. However, existing clusters will not be updated.

This KB will detail how to change the Service Network CIDR Range for existing clusters.

Resolution

To do this, we will be using Kubernetes Profiles

  1. Create a file profile.json to define our Kubernetes Profile.
  2. Insert into the file the following json, replacing the below values:
    • profile_name: an unique name for your profile.
    • description: a description for your profile.
    • range: the new Service Network CIDR range you want your cluster to use.
{
    "name": "<profile_name>",
    "description": "<description>",
    "customizations": [
        {
            "component": "kube-apiserver",
            "arguments": {
                "service-cluster-ip-range": "<range>"
            }
        }
    ]
}

  3. Update the cluster with the command

tkgi update-cluster <cluster_name> --kubernetes-profile <profile_name>

replacing <cluster_name> with the name of the cluster you wish to update, and <profile_name> with the name of your profile, as defined in the previous step.

You can then verify the change with the command:

bosh -d <deployment_name> manifest | grep service-cluster-ip-range

You should now see the new CIDR Range you defined.