Pre-provisioned Create a New Cluster
Create a Kubernetes cluster using the infrastructure definition
Once you’ve defined the infrastructure and control plane endpoints, you can proceed to creating the cluster by following these steps to create 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 corresponding section for custom cluster creation:
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.
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.
NOTE: When specifying the
cluster-name
, you must use the samecluster-name
as used when defining your inventory objects.NOTE: (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
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 thedkp 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:
CODEspec: clusterNetwork: pods: cidrBlocks: - 192.168.0.0/16 services: cidrBlocks: - 10.96.0.0/12
Create cluster command may take a while depending on the size of the cluster:
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
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.The output from this command is shortened here for reading clarity, but should begin like this:
CODEGenerating cluster resources cluster.cluster.x-k8s.io/preprovisioned-example created cont.........
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
If your cluster is air-gapped or you have a local docker registry, you must provide additional arguments when creating the cluster. These tell the cluster where to locate the local Docker registry to use by defining the URL.
CODEexport DOCKER_REGISTRY_URL="<https/http>://<registry-address>:<registry-port>" export DOCKER_REGISTRY_CA="<path to the CA on the bastion>" export DOCKER_REGISTRY_USERNAME="<username>" export DOCKER_REGISTRY_USERNAME="<password>"
DOCKER_REGISTRY_URL
: the address of an existing Docker registry accessible in the VPC that the new cluster nodes will be configured to use a mirror registry when pulling images.DOCKER_REGISTRY_CA
: (optional) the path on the bastion machine to the Docker registry CA. Konvoy will configure the cluster nodes to trust this CA. This value is only needed if the registry is using a self-signed certificate and the AMIs are not already configured to trust this CA.DOCKER_REGISTRY_USERNAME
: optional, set to a user that has pull access to this registry.DOCKER_REGISTRY_PASSWORD
: optional if username is not set.
dkp 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> \
--registry-mirror-url=${DOCKER_REGISTRY_URL} \
--registry-mirror-cacert=${DOCKER_REGISTRY_CA} \
--registry-mirror-username=${DOCKER_REGISTRY_USERNAME} \
--registry-mirror-password=${DOCKER_REGISTRY_PASSWORD}
Depending on the cluster’s size, it will take a few minutes to create.
4. After the creation, use this command to get the Kubernetes kubeconfig for the new cluster and begin deploying workloads:
dkp 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 Cluster Self-managed to continue the process.