EKS Anywhere., preparing the cluster templates
This article is part of the EKS Anywhere series EKS Anywhere, extending the Hybrid cloud momentum | by Ambar Hassani | Apr, 2022 | Medium
The YAML template used by the EKS Anywhere software is at the heart of the cluster creation process. Therefore, it’s imperative for us to understand how this template is structured and the necessary modifications that should be performed to create the cluster. As we can observe in the associated article that talks about the architectural understanding., EKS Anywhere clusters can operate in three modes
- Standalone workload cluster
- Dedicated management cluster
- Workload cluster managed by a dedicated management cluster
The below video talks to the specifics of the cluster YAML template
As you can see in the below visual, I have tried to place various configuration blocks and their linkages within the template.
No matter which type of cluster one would like to create, the basic template remains the same except for the “name of the management cluster” section.
How is the template leveraged in EKS Anywhere deployments?
As one can observe, the template is nothing, but a set of Custom Resource Definitions that will be ultimately leveraged by EKS-A controller and Cluster API to communicate with vSphere in the backend. These resource definitions are mainly grouped into:
- Cluster
- VSphereDataCenterConfig
- VSphereMachineConfig
We have already discussed this in the article EKS Anywhere, Decoding the architecture. The lifecycle of the EKS-A upon creation, upgrades, scaling are all guided by the YAML template observed as Custom Resource Definitions used by EKS-A controller and Cluster API controllers
There is a sample cluster template already provided in the GitHub repository. The template mainly creates configuration references for control plane nodes, etcd nodes and worker nodes in an EKS Anywhere cluster.
Step-1 prepare a baseline YAML template
The base template which is already placed in the EKS Administrative machine $HOME/eks-anywhere/cluster-samples/cluster-sample.yaml can become your re-usable template requiring changes to only the cluster name and API server static IP address. Start with the below steps to create a base template:
- Ensure that the Ubuntu OS templates are created, customized and named accordingly as discussed in the previous articles.
- Edit the cluster YAML sample template on the EKS Anywhere admin machine
- Edit the count of nodes as per requirement in each of the spec attributes of the Cluster resource
- Next change the vSphere specific parameters in the vSphereDataCenterConfig block
- Alter the vSphere specific parameters, vCPU, memory and the OS template name in the respective VSphereMachineconfig blocks for control, worker and etcd nodes
Once this is done, this base YAML template that can be reused with minimal changes to deploy EKS Anywhere clusters by just changing the name of the workload and management cluster along with the API server endpoint static IP address
Step-2 Creating clusters from baseline YAML template
With the base template in place, one will need to only change the cluster name and the API server static IP address. This entire process can be done via a manual sed commands before applying the eksctl anywhere create cluster command.
Alternatively, we have wrapped those commands into a two bash scripts for cluster creation and deletion
The scripts are already placed in $HOME of the EKS Anywhere administrative machine
- Script to create cluster: $HOME/create-eksa-cluster.sh
- Script to delete cluster: $HOME/delete-eksa-cluster.sh
Important note with regards to the above scripts
- For standalone workload and dedicated management clusters, keep the name of management cluster name and the workload cluster to be exactly same in the bash script input
- For workload clusters managed via a dedicated management cluster, provide the correct management cluster name that will be used for the workload cluster being created or deleted
Hopefully, you have been able to understand the role and the construction of the sample cluster template used to create EKS Anywhere clusters.
cheers
Ambar@thecloudgarage
#iwork4dell