This topic describes how to use compute profiles using the VMware Tanzu Kubernetes Grid Integrated Edition (TKGI) Command Line Interface (TKGI CLI).
A compute profile enables TKGI cluster managers to configure TKGI-provisioned Kubernetes clusters with custom settings:
pks.clusters.admin
accounts.pks.cluster.manage
accounts.TKGI supports creating and managing compute profiles for Linux- and Windows-based Kubernetes clusters on vSphere with NSX-T networking and for Linux-based Kubernetes clusters on vSphere without NSX-T networking.
For an overview of how compute profile are created, see How Compute Profiles are Created below.
For information about using compute profiles, see:
TKGI cluster administrators can create and delete compute profiles. For information on how cluster administrators create and delete compute profiles, see Creating and Managing Compute Profiles with the CLI (vSphere).
To list available compute profiles, run the following command:
tkgi compute-profiles
For example:
$ tkgi compute-profiles
Name Description
custom-nodes-compute-profile custom-nodes-compute-profile
custom-node-pools-compute-profile custom-node-pools-compute-profile
Dc-east-single-node-pool A profile for the east datacenter with a single node pool
dc-east-mixed A profile for the east datacenter with heterogeneous workers
You can assign a compute profile to a Kubernetes cluster at the time of cluster creation.
To create an TKGI-provisioned Kubernetes cluster with a compute profile, run the following command:
tkgi create-cluster CLUSTER-NAME --external-hostname HOSTNAME --plan PLAN-NAME --compute-profile COMPUTE-PROFILE-NAME --node-pool-instances "NODE-POOL-NAME:INSTANCES"
Where:
CLUSTER-NAME
is a unique name for your cluster.Note: Use only lowercase characters when naming your cluster if you manage your clusters with Tanzu Mission Control (TMC). Clusters with names that include an uppercase character cannot be attached to TMC.
HOSTNAME
is your external hostname used for accessing the Kubernetes API.PLAN-NAME
is the name of the TKGI plan you want to use for your cluster.COMPUTE-PROFILE-NAME
is the name of the compute profile you want to use for your cluster.--node-pool-instances
overrides the worker node instance counts specified in the compute profile:
NODE-POOL-NAME
is the name of the node pool you want to specify the number of worker node instances for.INSTANCES
is the number of worker nodes for the node pool name specified as NODE-POOL-NAME
.For example:
tkgi create-cluster custom-node-pools -e test.tkgi.shep.api.com --compute-profile custom-node-pools-compute-profile -p "small" --node-pool-instances "tiny-1:3"
TKGI Version: 1.9.0-build.11
Name: test
K8s Version: 1.18.5
Plan Name: small
UUID: <UUID of deployment>1
Last Action: CREATE
Last Action State: in progress
Last Action Description: Creating cluster
Kubernetes Master Host: test.tkgi.shep.api.com
Kubernetes Master Port: 8443
Worker Nodes: 4
Kubernetes Master IP(s): In Progress
Network Profile Name:
Kubernetes Profile Name:
Compute Profile Name: custom-node-pools-compute-profile
Tags:
TKGI supports changing the compute profile for an already created cluster.
You can use this procedure to:
To assign a compute profile to an existing cluster, complete the following:
Before assigning a compute profile to an existing cluster:
Review the following strict validation rules for the tkgi update-cluster --compute-profile
command:
--num-nodes
are ignored.--node-pool-instances
must match the labels of the node pools specified in the compute profile.Review the following precautions and warnings:
Warning: Do not scale out or scale in existing control plane nodes by reconfiguring the TKGI tile or by using a compute profile. Reducing a cluster’s number of control plane nodes might remove a control plane node and cause the cluster to become inactive.
Warning: If cluster update fails while applying a new compute profile with revised node pool names, do not reapply the previous compute profile: the cluster’s worker nodes will be deleted. If you encounter this scenario, fix the new compute profile configuration without modifying the node pool names, and retry your cluster update. For more information, see tkgi update-cluster compute profile failure in the VMware Tanzu Knowledge Base.
Note: Compute profiles do not support moving a cluster’s nodes to different Availability Zones.
Resolve any conditions matching the listed concerns, precautions or warnings.
To assign a compute profile to an existing cluster:
Select the compute profile to apply to the cluster:
Run the following command to update the cluster with the new compute profile:
tkgi update-cluster CLUSTER-NAME --compute-profile NEW-COMPUTE-PROFILE-NAME --node-pool-instances "NODE-POOL-NAME:INSTANCES"
Where:
CLUSTER-NAME
is the name of the existing Kubernetes cluster.NEW-COMPUTE-PROFILE-NAME
is the name of the new compute profile you want to apply to the cluster.--node-pool-instances "NODE-POOL-NAME:INSTANCES"
. Use --node-pool-instances
to update the number of worker nodes in a node pool. NODE-POOL-NAME
is the name of the node pool in the new compute profile to be updated. INSTANCES
is the new number of worker nodes in a node pool.For example:
tkgi update-cluster test --compute-profile new-compute-profile
Update summary for cluster test:
Compute Profile Name: new-compute-profile
Are you sure you want to continue? (y/n): y
Use 'tkgi cluster test' to monitor the state of your cluster
WARNING: Updating a cluster with a compute profile is not supported on a TKGI cluster that has not been upgraded to the current TKGI version. For more information, see Tasks Supported Following a TKGI Control Plane Upgrade in About Tanzu Kubernetes Grid Integrated Edition Upgrades.
TKGI supports using the CLI to resize a cluster already created or assigned with a compute profile, without having to create a new compute profile.
To do this, run the tkgi update-cluster
command with the --node-pool-instances
option. Pass in a comma-separated list that associates node pools defined in the compute profile with new instance counts. This changes the number of instances from each node pool. The node pools must already be defined in the cluster’s compute profile.
For example, to resize a cluster custom-node-pools-cluster
to use three nodes from the node pool named tiny-1
and seven from the pool named medium-2
:
tkgi update-cluster custom-node-pools-cluster
--node-pool-instances "tiny-1:3,medium-2:7"