Several small procedures work together to create a new Azure Kubernetes cluster. Be sure to read each one carefully, as some are optional. The basic process is:
-
Satisfy the prerequisites.
-
Inspect and edit the cluster objects
Editing the objects allows you to use the optional procedures for:
- Specifying an HTTP proxy
- Configuring the cluster to use existing network infrastructure
Be sure also that you review the known limitations section
Prerequisites
- Before you begin, make sure you have created a Bootstrap cluster.
Name your cluster
-
Give your cluster a unique name suitable for your environment.
-
Set the environment variable:
Naming Tips and Tricks
-
To create a cluster name that is unique, use the following command:
The output appears similar to:
This command creates a unique name every time you run it, so use it carefully.
Create new Azure Kubernetes cluster objects
This procedure uses the --dry-run
and --output-yaml
flags together to create basic Azure Kubernetes cluster objects in a YAML file. This approach allows you to examine the YAML objects before creating the actual Azure Kubernetes cluster itself.
When creating the basic Azure Kubernetes cluster objects, you need to first consider whether you need to use an HTTP proxy. If you do, you need to do some additional configuration when creating the cluster objects. Consult the optional “Configure the control plane and workers to use an HTTP Proxy” section for more details.
-
Generate the basic Kubernetes cluster objects:
The output of this command is a ${CLUSTER_NAME}.yaml
file that you can examine or modify. If you use this method to create a basic cluster without HTTP proxies, skip to the heading, “Inspect or edit the cluster objects.”
(Optional) Configure the control plane and workers to use an HTTP Proxy
To configure the Control Plane and Worker nodes to use an HTTP proxy:
-
Copy the commands in the following code block to an editor and apply the list of edits that follows to customize them, then execute them from the command line:
- Replace
example.org,example.com,example.net
with your internal addresses localhost
and127.0.0.1
addresses should not use the proxy10.96.0.0/12
is the default Kubernetes service subnet192.168.0.0/16
is the default Kubernetes pod subnetkubernetes,kubernetes.default,kubernetes.default.svc,kubernetes.default.svc.cluster,kubernetes.default.svc.cluster.local
is the internal Kubernetes kube-apiserver service.svc,.svc.cluster,.svc.cluster.local
is the internal Kubernetes services169.254.169.254
is the Azure metadata server.cloudapp.azure.com
allows the worker nodes to communicate directly to the kube-apiserver load balancer
- Replace
-
Copy and run the following command to create a Kubernetes cluster with HTTP proxy configured. (This step assumes you did not already create a cluster in the previous procedure.)
The output of this command is a ${CLUSTER_NAME}.yaml
file that you can examine or modify further.
Inspect or edit the cluster objects
-
Inspect or edit the cluster objects:
The objects are Custom Resources defined by Cluster API components, and they belong in three different categories:
-
Cluster
A Cluster object has references to the infrastructure-specific and control plane objects. Because this is an Azure cluster, there is an AzureCluster object that describes the infrastructure-specific cluster properties. Here, this means the Azure region, the VPC ID, subnet IDs, and security group rules required by the Pod network implementation.
-
Control Plane
A KubeadmControlPlane object describes the control plane, which is the group of machines that run the Kubernetes control plane components, which include the etcd distributed database, the API server, the core controllers, and the scheduler. The object describes the configuration for these components. The object also has a reference to an infrastructure-specific object that describes the properties of all control plane machines. Here, it references an AzureMachineTemplate object, which describes the instance type, the type of disk used, and the size of the disk, among other properties.
-
Node Pool
A Node Pool is a collection of machines with identical properties. For example, a cluster might have one Node Pool with large memory capacity, another Node Pool with GPU support. Each Node Pool is described by three objects: The MachinePool references an object that describes the configuration of Kubernetes components (for example, the kubelet) deployed on each node pool machine, and an infrastructure-specific object that describes the properties of all node pool machines. Here, it references a KubeadmConfigTemplate, and an AzureMachineTemplate object, which describes the instance type, the type of disk used, the size of the disk, among other properties.
For in-depth documentation about the objects, read Concepts in the Cluster API Book.
-
(Optional) Configure existing network infrastructure in the cluster
As part of inspecting and editing your cluster objects, you can also configure it to use existing network infrastructure. If you do not need to use an existing network infrastructure, you can skip this step.
-
Review the following AzureCluster excerpt, noting the entries under
networkSpec
for the apiServerLB, nodeOutboundLB, subnets, and vnet values:After you make and verify changes in these areas, save the file and go to the “create the actual cluster” procedure.
Create the actual Azure Kubernetes cluster
Use this procedure to create the Azure Kubernetes cluster when you finish your inspection and edits.
-
Create the cluster from the generated, and any modified, YAML objects using the command:
The output appears similar to:
-
Wait for the cluster’s control-plane Status to be Ready:
When the control plane status is Ready, the output is similar to:
After DKP creates the objects on the API server, the Cluster API controllers reconcile them. They create infrastructure and machines, and as they progress, they update the Status of each object.
-
Run the DKP Konvoy command to describe the current status of the cluster:
The output is similar to:
-
As they progress, the controllers also create Events. List the Events using the command:
For brevity, the example command also uses
grep
. You can use separate commands to get Events for specific objects, for example,kubectl get events --field-selector involvedObject.kind="AzureCluster"
andkubectl get events --field-selector involvedObject.kind="AzureMachine"
.The output is similar to:
Known Limitations
- The Konvoy version used to create a bootstrap cluster must match the Konvoy version used to create a workload cluster.
- Konvoy supports deploying one workload cluster.
- Konvoy generates a set of objects for one Node Pool.
- Konvoy does not validate edits to cluster objects.
Next, you can Explore the New Cluster.