Creating a node pool is useful when you need to run workloads that require machines with specific resources, such as a GPU, additional memory, or specialized network or storage hardware.

Prepare the environment

Follow these steps:

  1. Set the environment variable to the name you assigned this cluster with the command:

    export CLUSTER_NAME=my-vsphere-cluster
    CODE

  2. If your workload cluster is self-managed, as described in Make the New Cluster Self-Managed, configure kubectl to use the kubeconfig for the cluster:

    export KUBECONFIG=${CLUSTER_NAME}.conf
    CODE

  3. Define your node pool name:

    export NODEPOOL_NAME=example
    CODE

Create a vSphere node pool

Create a new vSphere node pool with 3 replicas using this command:

dkp create nodepool vsphere ${NODEPOOL_NAME} \
  --cluster-name=${CLUSTER_NAME} \
  --network=example_network \
  --data-center=example_datacenter \
  --data-store=example_datastore \
  --folder=example_folder \
  --server=example_vsphere_api_server_url\
  --resource-pool=example_resource_pool \
  --vm-template=example_vm_template \
  --replicas=3
CODE

The output resembles this example:

machinedeployment.cluster.x-k8s.io/example created
vspheremachinetemplate.infrastructure.cluster.x-k8s.io/example created
kubeadmconfigtemplate.bootstrap.cluster.x-k8s.io/example created
 ✓ Creating default/example nodepool resources
CODE

This example uses default values for brevity. Advanced users can use a combination of the --dry-run and --output=yaml or --output-directory=<your-target-directory>/ flags to get a complete set of node pool objects to modify locally or store in version control.