Skip to main content
Skip table of contents

vSphere: Create a Managed Cluster Using the DKP CLI

Creating a vSphere Managed cluster with the DKP CLI assumes that you already fulfilled all of the prerequisites and successfully created a vSphere Management cluster. Use this process and its procedures to create a Managed vSphere cluster.

When creating Managed clusters, you do not need to create and move CAPI objects, or install the Kommander component. Those tasks are only done on Management clusters!

The procedures to follow for creating a managed vSphere cluster from the DKP CLI include:

Choose a Workspace for the New Managed Cluster

  1. If you have an existing Workspace name, run this command to find the name:
    ⚠️ NOTE: If you need to create a new Workspace, follow the instructions to Create a Workspace.

    CODE
    kubectl get workspace -A
  2. When you have the Workspace name, set the WORKSPACE_NAMESPACE environment variable:

    CODE
    export WORKSPACE_NAMESPACE=<workspace_namespace>

Name your Cluster

Use an environment variable to contain your managed cluster’s name to make working with later YAML files and CLI commands easier.

  1. Give your cluster a unique name suitable for your environment.

  2. Set the CLUSTER_NAME environment variable with the command:

    CODE
    export CLUSTER_NAME=<my-managed-vsphere-cluster-name>

Create a New vSphere Kubernetes Cluster

DKP uses local static provisioner as the default storage provider. However, localvolumeprovisioner is not suitable for production use. You should use a Kubernetes CSI compatible storage that is suitable for production.

You can choose from any of the storage options available for Kubernetes. To disable the default that Konvoy deploys, set the default StorageClasslocalvolumeprovisioner as non-default. Then set your newly created StorageClass to be the default by following the commands in the Kubernetes documentation called Changing the Default Storage Class.

Follow these steps to create the cluster:

  1. Use the following command to set the environment variables for vSphere:

    CODE
    export VSPHERE_SERVER=example.vsphere.url
    export VSPHERE_USERNAME=user@example.vsphere.url
    export VSPHERE_PASSWORD=example_password

     

  2. Ensure your vSphere credentials are up-to-date by refreshing the credentials with the command:

    CODE
    dkp update bootstrap credentials vsphere
  3. Generate the Kubernetes cluster objects by copying and editing this command to include the correct values, including the VM template name you assigned in the previous procedure:

  • To increase Dockerhub's rate limit use your Dockerhub credentials when creating the cluster, by setting the following flag --registry-mirror-url=https://registry-1.docker.io --registry-mirror-username= --registry-mirror-password= on the dkp create cluster command.

  • The following example shows a common configuration. See dkp create cluster reference for the full list of cluster creation options:

 The command to create a basic vSphere managed cluster is:

CODE
dkp create cluster vsphere \
  --cluster-name ${CLUSTER_NAME} \
  --network <NETWORK_NAME> \
  --control-plane-endpoint-host <xxx.yyy.zzz.000> \
  --data-center <DATACENTER_NAME> \
  --data-store <DATASTORE_NAME> \
  --folder <FOLDER_NAME> \
  --server <VCENTER_API_SERVER_URL> \
  --ssh-public-key-file <SSH_PUBLIC_KEY_FILE> \
  --resource-pool <RESOURCE_POOL_NAME> \
  --vm-template <TEMPLATE_NAME> \
  --virtual-ip-interface <ip_interface_name> \
  --namespace ${WORKSPACE_NAMESPACE}

If your environment uses HTTP/HTTPS proxies, you must include the flags --http-proxy, --https-proxy, and --no-proxy and their related values in this command for it to be successful. More information is available in Configuring an HTTP/HTTPS Proxy.

Manually Attach a DKP CLI Cluster to the Management Cluster

  1. Find out the name of the created Cluster, so you can reference it later:

    CODE
    kubectl -n <workspace_namespace> get clusters
  2. Attach the cluster by creating a KommanderCluster:

    CODE
    cat << EOF | kubectl apply -f -
    apiVersion: kommander.mesosphere.io/v1beta1
    kind: KommanderCluster
    metadata:
      name: <cluster_name>
      namespace: <workspace_namespace>
    spec:
      kubeconfigRef:
        name: <cluster_name>-kubeconfig
      clusterRef:
        capiCluster:
          name: <cluster_name>
    EOF

If you have existing clusters or want to create other new, managed clusters to attach, there are many ways to attach a cluster with various requirements and restrictions. To see all the options, visit the section, Day 2 - Attach an Existing Kubernetes Cluster.

Next Steps:

At this point, you can:

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.