The Tanzu Kubernetes Grid Service provides a default container network interface (CNI) for Tanzu Kubernetes clusters. The default configuration lets you create clusters without the need to specify the CNI. You can change the default CNI by editing the service specification.

The Tanzu Kubernetes Grid Service supports two CNIs: Antrea and Calico, with Antrea being the default. For more information, see Tanzu Kubernetes Cluster Networking.

You can override the default CNI by explicitly specifying the CNI to use. Alternatively, you can change the default CNI by editing the TKG Service controller for CNIs.

Prerequisites

Procedure

  1. Once you are logged in to the Supervisor Cluster, switch context to the Supervisor Namespace.
    kubectl config use-context SUPERVISOR-NAMESPACE
  2. To load the CNI specification for editing, run the following kubectl edit command.
    kubectl edit tkgserviceconfigurations tkg-service-configuration
    The tkg-service-configuration service specification is opened in the default text editor defined by your KUBE_EDITOR or EDITOR environment variable.
  3. Edit the spec.defaultCNI value.
    For example, change from:
    spec:
      defaultCNI: antrea
    Change to:
    spec:
      defaultCNI: calico
  4. Save the change.
    When you save the change in the text editor, kubectl updates the tkg-service-configuration service specification.
  5. Verify that the default CNI is updated.
    kubectl get tkgserviceconfigurations
    NAME                                 DEFAULT CNI
    tkg-service-configuration            calico