You can use Tanzu CLI with a vSphere with Tanzu Supervisor Cluster that is running in a vSphere 7 instance. In this way, you can deploy Tanzu Kubernetes clusters to vSphere with Tanzu and manage their lifecycle directly from the Tanzu CLI.
vSphere with Tanzu provides a vSphere Plugin for
kubectl. The vSphere Plugin for
kubectl extends the standard
kubectl commands so that you can connect to the Supervisor Cluster from
kubectl by using vCenter Single Sign-On credentials. Once you have installed the vSphere Plugin for
kubectl, you can connect the Tanzu CLI to the Supervisor Cluster. Then, you can use the Tanzu CLI to deploy and manage Tanzu Kubernetes clusters running in vSphere.
Note: On VMware Cloud on AWS and Azure VMware Solution, you cannot create a Supervisor Cluster, and need to deploy a management cluster to run
Note: To run the Tanzu CLI
node-pool commands successfully, you need Tanzu CLI v1.5.x and your vSphere with Tanzu clusters must use the
v1alpha2 API. For more information, see Provisioning Tanzu Kubernetes Clusters Using the Tanzu Kubernetes Grid Service v1alpha2 API.
Download and install the
kubectl vsphere CLI plugin on the bootstrap machine on which you run Tanzu CLI commands.
For information about how to obtain and install
kubectl vsphere plugin, see Download and Install the Kubernetes CLI Tools for vSphere in the vSphere with Tanzu documentation.
(Optional) For secure login, configure the
kubectl vsphere plugin with a TLS certificate as described in Configure Secure Login for vSphere with Tanzu Clusters in the vSphere with Tanzu documentation.
Connect to the Supervisor Cluster and add it as a management cluster to the
From vCenter Hosts and Clusters view, in the left column, expand the nested Datacenter, the vCenter cluster that hosts the Supervisor Cluster, and its Namespaces object.
Under Namespaces, select the namespace containing or adjacent to the three SupervisorControlPlaneVM instances. In the main pane, select the Summary tab.
Under Summary > Status > Link to CLI Tools click Copy link and record the URL, for example
https://192.168.123.3. Remove the
https:// to obtain the Supervisor Cluster API endpoint,
SUPERVISOR_IP below, which serves as the download page for the Kubernetes CLI tools.
On the bootstrap machine, run the
kubectl vsphere login command to log in to vSphere 7 with your vCenter Single Sign-On user account.
Specify a vCenter Single Sign-On user account with the required privileges for Tanzu Kubernetes Grid operation, and the virtual IP (VIP) address for the control plane of the Supervisor Cluster. For example:
kubectl vsphere login --vsphere-username firstname.lastname@example.org --server=SUPERVISOR_IP
If you did not configure the
kubectl vsphere plugin with a trusted certificate, you can log in insecurely by appending
--insecure-skip-tls-verify=true to the command above.
Caution: Only use insecure login in a development environment.
Enter the password you use to log in to your vCenter Single Sign-On user account.
When you have successfully logged in,
kubectl vsphere displays all of the contexts to which you have access. The list of contexts should include the IP address of the Supervisor Cluster.
Set the context of
kubectl to the Supervisor Cluster.
kubectl config use-context SUPERVISOR_IP
Collect information to run the
tanzu login command, which adds the Supervisor Cluster to your Tanzu Kubernetes Grid instance:
tanzuCLI to use for the Supervisor Cluster, serving as a Tanzu Kubernetes Grid management cluster.
kubeconfigfile, which defaults to
~/.kube/configand is set by the
tanzu login command, passing in the values above.
In the example below, the
KUBECONFIG_PATH defaults to
~/.kube/config if the
KUBECONFIG env variable is not set.
$ tanzu login --name my-super --kubeconfig <KUBECONFIG_PATH> --context 10.161.90.119 ✔ successfully logged in to management cluster using the kubeconfig my-super
Check that the Supervisor Cluster was added by running
tanzu login again.
The Supervisor Cluster should be listed by the name that you provided in the preceding step:
tanzu login ? Select a server [Use arrows to move, type to filter] > my-vsphere-mgmt-cluster () my-aws-mgmt-cluster () SUPERVISOR_IP () + new server
You can now use the Tanzu CLI to deploy Tanzu Kubernetes clusters optimized for vSphere 7, via the Tanzu Supervisor Cluster. See Deploy a vSphere with Tanzu Cluster in Deploy Tanzu Kubernetes Clusters to vSphere.
You can also use the Tanzu CLI to manage the lifecycles of clusters that are already running there. For information about how to manage the lifecycle of clusters, see the topics in Manage Clusters.