Special thanks to Christian Liebner and Jürgen Mutzberg for the joint work on this blog!
Kubernetes is becoming more important in IT world. vRealize Automation has multiple ways to consume Kubernetes clusters reaching from Namespace-as-a-Service in Cloud Assembly up to full Kubernetes application in Codestream. For all those use cases it is required to have a Kubernetes cluster installed as pre-requisite. While there’s multiple ways and descriptions Kubernetes cluster installation, it might challenging for someone who has not done that before.
To ease deployment, we have created a blueprint that deploys a single-node Kubernetes cluster in fully automated way through a vRealize Automation blueprint. In addition, it automatically deploys and configures a Kubernetes load balancer on the single host which can be used to load balance Kubernetes applications. This is especially important if you want to leverage Codestream Smart Templates to create a CD pipeline as this expects a load balancer in place.
We are using Metal-LB in this example.
All deployment is based on a CentOS 7 image. Find here the list of required steps. I will not go into the details explaining each individual task.
- Create vSphere Template based on latest CentOS 7 64bit image
- Make sure firewalls are disabled (systemctl disable iptables)
- Update image with latest patches (yum -y update)
- Install cloud-init on the image (yum -y install cloud-init)
- Turn VM into vSphere template
- Create image mapping in vRealize Automation
- Create flavor mapping in vRealize Automation with at least 2 vCPU and 4 GB RAM
- Target network needs to provide internet access for download of the required packages
Download the kubernetes-single-node.yaml file (unzip).
You can copy and paste the content into a new blueprint. The only parts that need to be modified related to your environment are “image” and “flavor” (marked by << …>> sections). Obviously also other parts can be tailored accordingly like e.g. the network to be used. Likewise, the blueprint by default is configured for DHCP and expects a DHCP server in the target network. You can add the parameters for static IP configuration by customization spec or cloud-init (won’t cover it in this blog).
Deployment of the blueprint
On deployment of the blueprint there is only 1 input parameter required that specifies the IP range to be used for the load balancer. This must be an IP-range in the network where the VM is deployed to in the format x.x.x.x-y.y.y.y
To verify functionality, find below the commands to test incl. their expected outputs.
- kubectl get nodes
- kubectl get pods –all-namespaces
It might take a couple of minutes after the VM deployment has finished until the node is in ready status.