AWS Create a New Air-gapped Cluster
Prerequisites
Before you begin, make sure you have created a Bootstrap cluster.
By default, the control-plane Nodes will be created in 3 different zones. However, the default worker Nodes will reside in a single Availability Zone. You may create additional node pools in other Availability Zones with the dkp create nodepool
command.
Create a New AWS Air-gapped Kubernetes Cluster
Create a new AWS Kubernetes cluster
Name your cluster using the following characters:
a-z
,0-9
,.
, and-
. Cluster creation will fail if the name has capital letters. In AWS it is critical that the name is unique, as no two clusters in the same AWS account can have the same name. See Kubernetes for more naming information.
Set the environment variable to the name you assigned this cluster:CODEexport CLUSTER_NAME=<aws-example>
Export the variables such as custom AMI and existing infrastructure details for later use with the
dkp create cluster
command:
See the Custom AMI in Cluster Creation topic for more information.CODEexport AWS_AMI_ID=<ami-...> export AWS_VPC_ID=<vpc-...> export AWS_SUBNET_IDS=<subnet-...,subnet-...,subnet-...> export AWS_ADDITIONAL_SECURITY_GROUPS=<sg-...>
In previous DKP releases, AMI images provided by the upstream CAPA project would be used if you did not specify an AMI. However, the upstream images are not recommended for production and may not always be available. Therefore, DKP now requires you to specify an AMI when creating a cluster. To create an AMI, use Konvoy Image Builder.
There are two approaches to supplying the ID of your AMI. Either provide the ID of the AMI or provide a way for DKP to discover the AMI using location, format and OS information:
Option One - Provide the ID of your AMI:
Use the example command below leaving the existing flag that provides the AMI ID:
--ami AMI_ID
Option Two - Provide a path for your AMI with the information required for image discover:
Where the AMI is published using your AWS Account ID:
--ami-owner AWS_ACCOUNT_ID
The format or string used to search for matching AMIs and ensure it references the Kubernetes version plus the base OS name:
--ami-base-os ubuntu-20.04
The base OS information:
--ami-format 'example-{{.BaseOS}}-?{{.K8sVersion}}-*'
When using an existing air-gapped infrastructure, DKP does not create, modify, or delete the AWS resources such as Internet gateways, VPSs, subnets, etc. For more information, refer to AWS Air-gapped Environment Variables
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
Your cluster uses the existing local registry when attempting to pull images previously pushed to your registry. The registry variables were set during the BOOTSTRAP process on previous page and will be used with the flags during the
dkp create cluster
command next.
Create the Kubernetes cluster objects with a
dry run
. The following example shows a common configuration. See dkp create cluster aws reference for the full list of cluster creation options:CODEdkp create cluster aws --cluster-name=${CLUSTER_NAME} \ --vpc-id=${AWS_VPC_ID} \ --ami=${AWS_AMI_ID} \ --subnet-ids=${AWS_SUBNET_IDS} \ --internal-load-balancer=true \ --additional-security-group-ids=${AWS_ADDITIONAL_SECURITY_GROUPS} \ --registry-mirror-url=${REGISTRY_URL} \ --dry-run \ --output=yaml \ > ${CLUSTER_NAME}.yaml
Expand the drop-downs for more flags for use in cluster creation such as registry, HTTP, FIPS and other flags to apply in the step above.
Inspect or edit the generated cluster objects. Familiarize yourself with Cluster API before editing the cluster objects as edits can prevent the cluster from deploying successfully. See AWS Customizing CAPI Clusters.
CODEkubectl get clusters,kubeadmcontrolplanes,machinedeployments
(Optional) Modify Control Plane Audit logs - Users can make modifications to the
KubeadmControlplane
cluster-api object to configure differentkubelet
options. See the following guide if you wish to configure your control plane beyond the existing options that are available from flags.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>/
Wait for the cluster control-plane to be ready:
CODEkubectl wait --for=condition=ControlPlaneReady "clusters/${CLUSTER_NAME}" --timeout=60m
After the objects are created on the API server, the Cluster API controllers reconcile them. They create infrastructure and machines. As they progress, they update the Status of each object. Konvoy provides a command to describe the current status of the cluster:
CODEdkp describe cluster -c ${CLUSTER_NAME}
As they progress, the controllers also create Events. List the Events using this command:
CODEkubectl get events | grep ${CLUSTER_NAME}
DKP uses AWS CSI as the default storage provider. You can use a Kubernetes CSI compatible storage solution that is suitable for production. See the Kubernetes documentation called Changing the Default Storage Class for more information.
If you’re not using the default, you cannot deploy an alternate provider until after the dkp create cluster
is finished. However, it must be determined before Kommander installation.