AWS: Create a Managed Cluster Using the DKP CLI
In previous steps, you created a new Management cluster, which is self-managed. When you use these steps to create new Managed clusters, they will become Attached clusters under your Management 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!
Choose a Workspace for the New Cluster
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.CODEkubectl get workspace -A
When you have the Workspace name, set the
WORKSPACE_NAMESPACE
environment variable:CODEexport WORKSPACE_NAMESPACE=<workspace_namespace>
Name Your Cluster
The cluster name may only contain the following characters: a-z
, 0-9
, .
, and -
. Cluster creation will fail if the name has capital letters. See Kubernetes for more naming information.
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.
Follow these steps:
Give your cluster a unique name suitable for your environment.
In AWS it is critical that the name is unique, as no two clusters in the same AWS account can have the same name.
Set the environment variable:
export MANAGED_CLUSTER_NAME=<aws-additional>
Create New Cluster with the CLI
Execute this command to create your additional Kubernetes cluster using any relevant flags. This will create a new non-self-managed cluster that can be managed by management cluster you created in the previous section:
dkp create cluster aws \
--cluster-name=${MANAGED_CLUSTER_NAME} \
--additional-tags=owner=$(whoami) \
--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
Find out the
name
of the createdCluster
, so you can reference it later:CODEkubectl -n <workspace_namespace> get clusters
Attach the cluster by creating a
KommanderCluster
:CODEcat << 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 new clusters to attach, there are many ways to attach a cluster with various requirements and restrictions. To see all the options, visit the section in documentation Day 2 - Attach an Existing Kubernetes Cluster.