The following describes the process of adding nodes from VMware Cloud Director (VCD) to an existing static Deckhouse Kubernetes Platform (DKP) cluster.
Integration with VCD uses the cloud-provider-vcd module. It provides interaction between DKP and VMware Cloud Director, creation and deletion of virtual machines, retrieval of information about the VCD infrastructure, and integration with StorageClass and other provider capabilities.
This section describes two ways to add nodes:
- Automatic node creation in VCD. DKP creates virtual machines through the VCD API. VM parameters are defined by the VCDInstanceClass resource, and the required number of nodes is defined by the NodeGroup resource with the
CloudEphemeraltype. - Connecting manually created nodes through a bootstrap script. A virtual machine is created by the user in advance and connected to the cluster using the DKP bootstrap script. This scenario uses the NodeGroup resource with the
CloudStatictype.
Prerequisites for VCD
Before you begin, make sure that the following conditions are met:
- The cluster was created with the
clusterType: Staticparameter. - Network connectivity is configured between the network of static nodes and the network of virtual machines in VCD. VCD nodes added to the cluster have access to the Kubernetes API, DNS, and the required addresses according to the Network interaction and Network policy configuration sections. When using Cilium with pod traffic tunneling, the
tunnelModemode is selected according to the network connectivity between sites. - The requirements from the Connection and authorization in VMware vCloud Director section are met:
- A tenant with allocated resources is configured in VCD.
- A VCD account with a static password and administrator permissions is prepared.
- A working network with an enabled DHCP server is configured in VCD.
- The required VCD resources are prepared: VDC, vApp, templates, policies, and other parameters.
Adding automatically created nodes
-
Create a file with a ModuleConfig resource. For example,
cloud-provider-vcd-mc.yaml:apiVersion: deckhouse.io/v1alpha1 kind: ModuleConfig metadata: name: cloud-provider-vcd spec: version: 1 enabled: true settings: mainNetwork: <NETWORK_NAME> organization: <ORGANIZATION> virtualDataCenter: <VDC_NAME> virtualApplicationName: <VAPP_NAME> sshPublicKey: <SSH_PUBLIC_KEY> provider: server: <API_URL> username: <USER_NAME> password: <PASSWORD> insecure: falseWhere:
mainNetwork: Name of the network where cloud nodes will be placed in VCD.organization: Organization name in VCD.virtualDataCenter: Virtual Data Center name in VCD.virtualApplicationName: Name of the vApp where nodes will be created, for exampledkp-vcd-app.sshPublicKey: Public SSH key for accessing the nodes.provider.server: VCD API URL.provider.username: VCD username.provider.password: VCD user password.provider.insecure: Set totrueif VCD uses a self-signed TLS certificate.
If a token is used for authentication, specify
apiTokeninstead ofusernameandpassword:provider: server: <API_URL> apiToken: <API_TOKEN> insecure: false -
Apply the ModuleConfig:
d8 k apply -f cloud-provider-vcd-mc.yaml d8 k get mc cloud-provider-vcd -
Make sure that all pods in the
d8-cloud-provider-vcdnamespace are in theRunningstate:d8 k get pods -n d8-cloud-provider-vcd -
Make sure that StorageClasses for VCD have been created in the cluster:
d8 k get sc -
Create a file with the VCDInstanceClass and NodeGroup resources. For example,
vcd-instanceclass-nodegroup.yaml:--- apiVersion: deckhouse.io/v1 kind: VCDInstanceClass metadata: name: worker spec: rootDiskSizeGb: 50 sizingPolicy: <SIZING_POLICY> storageProfile: <STORAGE_PROFILE> template: <VAPP_TEMPLATE> --- apiVersion: deckhouse.io/v1 kind: NodeGroup metadata: name: worker spec: nodeType: CloudEphemeral cloudInstances: classReference: kind: VCDInstanceClass name: worker maxPerZone: 2 minPerZone: 1 nodeTemplate: labels: node-role/worker: "" -
Apply the manifest:
d8 k apply -f vcd-instanceclass-nodegroup.yamlAfter the manifest is applied, DKP will start creating virtual machines in VCD managed by the
node-managermodule. -
Make sure that the required number of nodes has appeared in the cluster:
d8 k get nodes -o wide -
If VM creation fails, check the Machine and MachineSet objects and the machine-controller-manager logs:
d8 k -n d8-cloud-instance-manager get machinesets,machines -o wide d8 k -n d8-cloud-instance-manager logs deploy/machine-controller-manager --tail=200
Adding manually created nodes through a bootstrap script
Before you begin, make sure that the following conditions are met:
-
The
cloud-provider-vcdmodule is enabled:d8 k get module cloud-provider-vcd -o wide -
The
cloud-provider-vcdmodule components are in theRunningstate:d8 k -n d8-cloud-provider-vcd get pods -o wide -
StorageClasses for VCD have been created in the cluster:
d8 k get sc - A virtual machine that will be connected to the cluster has been created in VCD.
- The virtual machine name in VCD matches the hostname inside the operating system.
-
The following value is set in the VM advanced parameters in VCD:
disk.EnableUUID = TRUE - The virtual machine is connected to the VCD network used as the main network for the cluster’s cloud nodes. Usually, this is the network specified in the
mainNetworkparameter of thecloud-provider-vcdconfiguration or in the VCDInstanceClass being used. - One of the package managers (
apt/apt-get,yum, orrpm) for a supported OS is installed on the virtual machine.
-
Create a file with a NodeGroup resource and the CloudStatic node type. For example,
cloud-static-nodegroup.yaml:d8 k apply -f - <<EOF apiVersion: deckhouse.io/v1 kind: NodeGroup metadata: name: cloud-static spec: nodeType: CloudStatic -
Make sure that the NodeGroup has been created and synchronized:
d8 k get nodegroup cloud-staticExample expected output:
NAME TYPE READY NODES UPTODATE INSTANCES DESIRED MIN MAX STANDBY STATUS AGE SYNCED cloud-static CloudStatic 0 0 0 1m True -
Get the bootstrap script for the created NodeGroup:
NODE_GROUP=cloud-static d8 k -n d8-cloud-instance-manager get secret manual-bootstrap-for-${NODE_GROUP} \ -o jsonpath='{.data.bootstrap\.sh}' > bootstrap.b64 -
Copy the bootstrap script to the virtual machine being connected:
scp bootstrap.b64 <USER>@<NODE_IP>:/tmp/bootstrap.b64 -
Connect to the virtual machine over SSH:
ssh <USER>@<NODE_IP> -
On the virtual machine, set permissions and run the bootstrap script:
base64 -d /tmp/bootstrap.b64 > /tmp/bootstrap.sh chmod +x /tmp/bootstrap.sh sudo bash /tmp/bootstrap.shAfter the bootstrap script is started, it will install the required components, configure the container runtime and kubelet, and connect the node to the cluster.
-
On the master node, check that the new node has appeared:
d8 k get nodes -o wideExample expected output:
NAME STATUS ROLES AGE VERSION INTERNAL-IP static-master-0 Ready master 1h v1.33.10 192.168.240.138 cloud-static-worker-0 Ready cloud-static 5m v1.33.10 192.168.240.151