This topic describes how to use 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.
Compute profiles let you customize cluster resources parameters.
TKGI cluster administrators can create and delete compute profiles, as described in the Creating and Managing Compute Profiles with the CLI (vSphere) topic.
After an administrator creates a compute profile, cluster managers (pks.cluster.manage
) can create clusters with it or assign it to existing clusters.
To list available compute profiles, run the following command:
tkgi compute-profiles
For example:
$ tkgi compute-profilesName 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: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:
Note: Compute profiles do not support moving a cluster’s nodes to different Availability Zones.
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 may remove a control plane node and cause the cluster to become inactive.
This is the procedure to change a cluster’s compute profile:
Do one of the following
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 clusterNEW-COMPUTE-PROFILE-NAME
is the name of the new compute profile you want to apply to the cluster.(Optional) --node-pool-instances "NODE-POOL-NAME:INSTANCES"
updates the number of worker nodes for node pool NODE-POOL-NAME
to be INSTANCES
. NODE-POOL-NAME
should be the name of the node pool in the new compute profile.
For example:
tkgi update-cluster test –compute-profile new-compute-profileUpdate 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
There are 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.Clusters created with compute profile in TKGI 1.8 and earlier:
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”