EKS Anywhere., Building the Administrative machine
This article is a part of the multi-part story of EKS Anywhere. Access it here https://ambar-thecloudgarage.medium.com/eks-anywhere-extending-the-hybrid-cloud-momentum-1c7b82f610e
NOTE: This story has been updated to include Terraform IaC to provision the EKS Anywhere Administrative machine and to accommodate the image-builder pre-requisites for ubuntu OVA images
EKS Anywhere Administrative machine is a term used to reference a virtual machine that allows conducting all EKS Anywhere related tasks via a combination of eksctl and kubectl command line. This is the first virtual machine that one has to setup using a combination of various toolsets mainly Docker and EKS Anywhere packages.
Administrative machine specifications: 4 vCPU, 8GB RAM, 100GB Storage (minimum recommended is 30, however 100 is preferred), ubuntu 20.04 Operating System, Access to Internet (direct or proxied) for downloading release bundles and packages. In my experience, the cluster builds and other processes are quicker with the above specifications.
The process is fairly simple; however, we will detail out every step to ensure consistent deployments and for individuals who like exact steps
Step-1 Prepare the base ubuntu template
Logon to the vSphere web client and create a folder named “Templates” if it does not exist already. Please ensure the folder name is Templates as in case sensitive. This folder is also going to be used EKS Anywhere to store the OVA templates and the name is hard corded in the automation scripts of EKS Anywhere.
We will now focus on creating a bare bones ubuntu 20.04 desktop virtual machine in the Templates folder.
Since the EKS-Administrative machine for installing additional use-case centric software (keycloak, gitlab, etc.), it is best to keep it at 4 vCPU, 16GB RAM, 100GB disk. Refer to the below video to create the template.
Once the virtual machine is created, login via putty or vsphere web console to enable SSH on the same machine by running the below commands
sudo apt-get install openssh-server
sudo systemctl enable ssh --now
sudo systemctl start ssh
Next, right-click on this newly created virtual machine in vSphere web-console, power it off and convert it into a template. In my case, I have named it as ubuntu-2004-desktop.
So now the base template named is ready ubuntu-2004-desktop in the Templates folder from which we can start creating the EKS Anywhere Administrative machine and installing various tools and packages.
Step-2 Create the EKS Anywhere Administrative machine from the base ubuntu template
A typical manual method would include using the vSphere web console to create a new machine from the above template, SSH into it and install various packages. However, in this case, we will use Terraform to showcase Infrastructure-as-a-code to create the intended virtual machine and deploy various software packages.
The below video highlights the steps to create the EKS Anywhere Administrative machine
Steps to be followed
- Clone or download the git repository https://github.com/thecloudgarage/eks-anywhere.git to any machine that has Terraform installed and bears connectivity to vSphere endpoint
- Navigate to eksa-admin-machine/terraform sub-directory within the cloned repository
- Edit the variables.tf file to adjust the variables as per specific environment
- Apply the terraform configurations to create the EKS Anywhere administrative machine
The variables.tf file can be observed below
variable "vsphere_user" {
description = "vSphere username"
type = string
default = "ambar@vsphere.local"
}
variable "vsphere_password" {
description = "vSphere password"
type = string
sensitive = true
default = "Vsphere@1234"
}
variable "vsphere_server" {
description = "vSphere server ip or fqdn"
type = string
default = "vc.iac.ssc"
}
variable "vsphere_datacenter" {
description = "vSphere datacenter name"
type = string
default = "IAC-SSC"
}
variable "vsphere_compute_cluster" {
description = "vSphere Cluster name"
type = string
default = "IAC"
}
variable "vsphere_resource_pool" {
description = "vSphere existing resource pool to be used for this virtual machine"
type = string
default = "Test"
}
variable "vsphere_datastore" {
description = "vSphere datastore name"
type = string
default = "CommonDS"
}
variable "vsphere_network" {
description = "vSphere network to be used for the virtual machine"
type = string
default = "iac_pg"
}
variable "vsphere_templates_folder" {
description = "vSphere templates folder for all base templates"
type = string
default = "Templates"
}
variable "existing_virtual_machine_template_name" {
description = "Template name to be used for this virtual machine. Must be an existing template located in Templates folder"
type = string
default = "ubuntu-2004-desktop"
}
variable "virtual_machine_folder_name" {
description = "Existing Folder name where the virtual machine will be configured"
type = string
default = "eks-anywhere"
}
variable "virtual_machine_name" {
description = "Name of the virtual machine"
type = string
default = "eksa-admin-machine"
}
variable "virtual_machine_vcpu_count" {
description = "virtual machine vCPU count"
type = number
default = 4
}
variable "virtual_machine_memory" {
description = "virtual machine Memory"
type = number
default = 16384
}
variable "virtual_machine_disk0_size" {
description = "virtual machine disk0 size"
type = number
default = 100
}
variable "virtual_machine_root_password" {
description = "virtual machine password"
type = string
sensitive = true
default = "ubuntu"
}
variable "virtual_machine_static_ip_address" {
description = "Static IP address to be used for the virtual machine"
type = string
default = "172.24.165.50"
}
variable "virtual_machine_subnet_mask" {
description = "virtual machine subnet mask"
type = number
default = 22
}
variable "dns_servers" {
description = "List of comma separated DNS server values"
type = list
default = ["172.24.164.10"]
}
variable "virtual_machine_domain_name" {
description = "Domain name to be associated with the virtual machine"
type = string
default = "iac.ssc"
}
variable "ipv4_gateway" {
description = "IPv4 gateway for the virtual machine"
type = string
default = "172.24.164.1"
}
Note:
- Keep the OS base template in the variables.tf as ubuntu-2004-desktop
- DO NOT CHANGE the ubuntu username and password of the EKS Anywhere administrative machine (at-least for this saga series). In production you might want to change the password accordingly.
- DO NOT CHANGE the bootstrapping scripts or paths within the cloned git repository
The structure of the main.tf file that is used to create the EKS Anywhere administrative machine is observed below
The above visual can be observed in the actual terraform code for main.tf file and the sequence of creating the EKS Anywhere administrative machine with respective software configurations can be well understood.
Once variables.tf has been edited, execute the terraform commands within the sub-directory itself to start the procedure
terraform init
terraform plan
terraform apply
Once the terraform installation is complete, SSH into the static IP defined for the EKS Anywhere admin machine. Issue the below commands to verify successful installation of the key software packages on EKS Anywhere Administrative machine.
docker -v
Docker version 20.10.18, build b40c2f6
brew -v
Homebrew 3.6.2
eksctl anywhere version
v0.11.3
What gets installed on the EKS Anywhere administrative machine
- Docker and Docker-compose
- Homebrew
- EKS Anywhere — version installed in my case is 0.11.3
- EKS Anywhere installation includes eksctl cli and kubectl cli by default.
In addition to the above, our terraform script will also install other packages on the EKS Anywhere administrative machine. These additional packages will aid some of the other exercises performed in this saga series.
- helm3, jq, yq, argocd cli, flux cli
Also, a user named “image-builder” with sudo access is created with the password of ubuntu to facilitate creation of ubuntu OVAs that will be running in the EKS Anywhere cluster nodes. More on this in the next section.
If one is seriously interested in greater detail of what’s installed inside of EKS Anywhere build-tooling, then one can visit the GitHub page aws/eks-anywhere: Run Amazon EKS on your own infrastructure (github.com). The above GitHub project provides the list of open-source projects and the entire build tooling used by EKS Anywhere.
That’s it, the EKS Administrative machine is installed, and we can use it to create EKS Anywhere clusters.
cheers,
Ambar@thecloudgarage
#iwork4dell