Cloud Director Create a New Cluster
Before beginning to create your new cluster, confirm you can reach any of the IPs in the range allocated to the load balancer pool so the CAPVCD drivers can reach it during cluster creation.
Flags Specific to VMware Cloud Director Cluster Creation
When creating a VMware Cloud Director(VCD) cluster, CPU and Memory flags are needed to reference the VM Sizing Policies:
For CPU and Memory, the VCD Provider creates the appropriate VM Sizing Policies. Then either the Provider or Tenant User with cluster creation rights references these VM Sizing Policies when creating the cluster by using those flags:
--control-plane-sizing-policy
--worker-sizing-policy
If the Service Provider(SP) has given a tenant user the permissions to create clusters inside their own Organization, then that tenant user will need to reference those flags are well.
Name your Cluster
Give your cluster a unique name suitable for your environment. The cluster name may only contain the following characters:
a-z
,0-9
,.
, and-
. Cluster creation will fail if the name has capital letters. See Kubernetes for more naming information.In Cloud Director it is critical that the name is unique, as no two clusters in the same Organization can have the same name.
Set the environment variable:
CODEexport CLUSTER_NAME=vcd-example
To increase Docker Hub's rate limit use your Docker Hub credentials when creating the cluster, by setting the following flag --registry-mirror-url=https://registry-1.docker.io --registry-mirror-username=<username> --registry-mirror-password=<password>
on the dkp create cluster
command.
Create a New Cloud Director Cluster
After you have met all the prerequisites, begin creating a cluster:
Cloud Director needs the Base OS image and VM Template from vSphere to be converted to a vApp Template and listed in the tenant Organization’s catalog.
Create a vApp template using the instructions from the previous section of documentation: Cloud Director Create Image and Template
Set Refresh API token using the instructions from VMware:
CODEexport VCD_REFRESH_TOKEN=<REFRESH TOKEN>
You must provide the refresh tokens (<REFRESH TOKEN>) when provisioning a cluster. See the VMware Documentation for details: https://docs.vmware.com/en/VMware-Cloud-Director/10.4/VMware-Cloud-Director-Tenant-Portal-Guide/GUID-A1B3B2FA-7B2C-4EE1-9D1B-188BE703EEDE.html#procedure-2
Create a Kubernetes cluster:
Reference the VM Sizing Policies during cluster creation using the flags:--control-plane-sizing-policy
--worker-sizing-policy
BASHdkp create cluster vcd --cluster-name ${CLUSTER_NAME} \ --site "" \ --organization "" \ --data-center "" \ --catalog "" \ --vapp-template "" \ --network "" \ --ssh-public-key-file "" \ --dry-run \ --output=yaml \ > ${CLUSTER_NAME}.yaml
(Optional) Alternatively, you can create individual files with different smaller manifests for ease in editing using the
--output-directory
flag. This will create multiple files in the specified directory which must already exist:CODE--output-directory=<existing-directory>
Description of parameters:
--site
: the cloud director's endpoint with the format https://VCD_HOST.--organization
: the tenant Organization name--data-center
: the Virtual Data Center(VDC) name--catalog
: the folder name where vApp templates are located--network
: your private network
See dkp create cluster vcd for Cloud Director reference to see the full list of cluster creation options and their descriptions.
Create the cluster from the objects. A warning will appear in the console if the resource already exists and will require you to remove the resource or update your YAML.
CODEkubectl create -f ${CLUSTER_NAME}.yaml
If you used the --output-directory
flag in your dkp create .. --dry-run
step above, create the cluster from the objects by specifying the directory in the command:
kubectl create -f <existing-directory>
Wait for the cluster control-plane to be ready:
BASHkubectl wait --for=condition=ControlPlaneReady "clusters/${CLUSTER_NAME}" --timeout=20m
Run the DKP describe command to monitor the current status of the cluster:
BASHdkp describe cluster -c ${CLUSTER_NAME}
CODENAME READY SEVERITY REASON SINCE MESSAGE Cluster/vcd-example True 52s ├─ClusterInfrastructure - vcdCluster/vcd-example ├─ControlPlane - KubeadmControlPlane/vcd-example-control-plane True 52s │ ├─Machine/vcd-example-control-plane-6fbzn True 2m32s │ │ └─MachineInfrastructure - vcdMachine/vcd-example-control-plane-62g6s │ ├─Machine/vcd-example-control-plane-jf6s2 True 7m36s │ │ └─MachineInfrastructure - vcdMachine/vcd-example-control-plane-bsr2z │ └─Machine/vcd-example-control-plane-mnbfs True 54s │ └─MachineInfrastructure - vcdMachine/vcd-example-control-plane-s8xsx └─Workers └─MachineDeployment/vcd-example-md-0 True 78s ├─Machine/vcd-example-md-0-68b86fddb8-8glsw True 2m49s │ └─MachineInfrastructure - vcdMachine/vcd-example-md-0-zls8d ├─Machine/vcd-example-md-0-68b86fddb8-bvbm7 True 2m48s │ └─MachineInfrastructure - vcdMachine/vcd-example-md-0-5zcvc ├─Machine/vcd-example-md-0-68b86fddb8-k9499 True 2m49s │ └─MachineInfrastructure - vcdMachine/vcd-example-md-0-k8h5p └─Machine/vcd-example-md-0-68b86fddb8-l6vfb True 2m49s └─MachineInfrastructure - vcdMachine/vcd-example-md-0-9h5vn
⚠️ NOTE: In the Cloud Director interface, you can find this new cluster under the Applications tab - Virtual Applications (vApp). One vApp per cluster will be created into CAPVCD with virtual machine information as well as worker node and control plane node information.
EXAMPLE: