Pre-provisioned Create a New Cluster
After you have defined the infrastructure and control plane endpoints, you create a Kubernetes cluster using the infrastructure definition. Create the cluster by following these steps to spin up a new pre-provisioned cluster.
Before you create a new DKP cluster below, you may choose an external load balancer or virtual IP and use the corresponding dkp create cluster
command example from that page in the docs from the links below. Other customizations are available, but require different flags during dkp create cluster
command also. Refer to Pre-provisioned Cluster Creation Customization Choices for more cluster customizations.
DKP uses localvolumeprovisioner
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.
NOTE: When specifying the cluster-name
, you must use the same cluster-name
as used when defining your inventory objects.
NOTE: 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= --registry-mirror-password=
on the dkp create cluster command
.
NOTE: Ensure your subnets do not overlap with your host subnet because they cannot be changed after cluster creation. If you need to change the kubernetes subnets, you must do this at cluster creation. The default subnets used in DKP are:
spec:
clusterNetwork:
pods:
cidrBlocks:
- 192.168.0.0/16
services:
cidrBlocks:
- 10.96.0.0/12
Generate the Kubernetes cluster objects:
The following command relies on the pre-provisioned cluster API infrastructure provider to initialize the Kubernetes control plane and worker nodes on the hosts defined in the inventory. It uses the default external load balancer.
(Optional) If you have overrides for your clusters, you must specify the secret as part of the create cluster command. If these are not specified, the overrides for your nodes will not be applied.
--override-secret-name=$CLUSTER_NAME-user-overrides
(Optional) Use a registry mirror. Configure your cluster to use an existing local registry as a mirror when attempting to pull images previously pushed to your registry. Instructions in the expandable section:
Create cluster command - Depending on the cluster size, it will take a few minutes to create the Kubernetes cluster objects:
CODEdkp create cluster preprovisioned \ --cluster-name ${CLUSTER_NAME} \ --control-plane-endpoint-host <control plane endpoint host> \ --control-plane-endpoint-port <control plane endpoint port, if different than 6443> \ --override-secret-name=$CLUSTER_NAME-user-overrides \ --dry-run \ --output=yaml \ > ${CLUSTER_NAME}.yaml
Virtual IP ALTERNATIVE - if you don’t have an external LB, and wish to use a VIRTUAL IP provided by kube-vip, specify these flags example below:
CODEdkp create cluster preprovisioned \ --cluster-name ${CLUSTER_NAME} \ --control-plane-endpoint-host 196.168.1.10 \ --virtual-ip-interface eth1 \ --dry-run \ --output=yaml \ > ${CLUSTER_NAME}.yaml
Cluster creation results:
Inspect or edit the cluster objects and familiarize yourself with Cluster API before editing the cluster objects as edits can prevent the cluster from deploying successfully. See Pre-provisioned Customizing CAPI Clusters .
Familiarize yourself with Cluster API before editing the cluster objects as edits can prevent the cluster from deploying successfully.
Create the cluster from the objects generated in the
dry run
. 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
NOTE: If you used the
--output-directory
flag in yourdkp create .. --dry-run
step above, create the cluster from the objects you created by specifying the directory:CODEkubectl create -f <existing-directory>/
Use the wait command to monitor the cluster control-plane readiness:
CODEkubectl wait --for=condition=ControlPlaneReady "clusters/${CLUSTER_NAME}" --timeout=30m
Output:
CODEcluster.cluster.x-k8s.io/preprovisioned-example condition met
After the creation, use this command to get the Kubernetes kubeconfig for the new cluster and begin deploying workloads:
CODEdkp get kubeconfig -c ${CLUSTER_NAME} > ${CLUSTER_NAME}.conf
Azure requires changing the CNI encapsulation type of Calico from the default of IPtoIP to VXlan. If changing the Calico encapsulation, D2iQ recommends changing it after cluster creation, but before production.
Audit logs
To modify Control Plane Audit logs settings using the information contained in the page Configuring the Control Plane.
Further Optional Steps
Next Step
When you complete this procedure, move on to Pre-provisioned Make your Cluster Self-managed to continue the process.