Kubernetes as a Service
In 2017 I wrote a blog on Containers as a Service. In that time Docker containers were the next new big thing and VMware created a tightly integrated solution for vSphere, named vSphere Integrated Containers (VIC) to run containers on vSphere like a VM and manage it with vCenter Server while developers could leverage the Docker API/CLI. To manage these containers, container images and configurations in a cool interface, VMware created Admiral and Admiral was eventually integrated into vRealize Automation 7.x to create self-service capabilities for applications running in containers.
Today, containers are the basis for all modern applications and a well written 12-factor application can easily consist of tens of containers who need to be managed and orchestrated as one entity. This is where Kubernetes comes in. Kubernetes is the defacto standard for declarative container orchestration. Meanwhile, VMware introduced a new Modern Application strategy and a set of products (Tanzu) to easily Build, Run and Manage applications based on containers and running on Kubernetes. Also, vRealize Automation 8 and vRealize Automation Cloud were released, with a complete new architecture and agile Cloud Management capabilities. The Admiral integration for containers is removed but new capabilities were introduced to support Kubernetes. Kubernetes as a Service was born.
Clusters, Namespaces and Pipelines
vRealize Automation supports multiple Kubernetes use cases like requesting and deploying Kubernetes Clusters and Namespaces from the self-Service Catalog in Service Broker and manage them through Cloud Assembly. Or using Kubernetes as an end-point in Code Stream for deploying modern applications using delivery pipelines.
All use cases start with a blueprint. I created two blueprints, a single-node Kubernetes cluster and a scalable multi-node Kubernetes cluster, that deploy Kubernetes on a fully automated way so that it can easily be connected up to vRealize Automation. There’s also a third blueprint to create a Kubernetes Namespace with a memory quota limit.
The blueprints can be downloaded here from my GitHub account.
Before importing the blueprints and deploying it, make sure that you have a Ubuntu 18.04 template ready to be used as image mapping for Cloud Assembly. The Ubuntu template must have Cloud-init installed and correctly configured. To create such an image follow this blog here.
The blueprint makes use of a static IP address. Make sure that you have a network profile setup using the internal (or external) IPAM functionality.
The single-node cluster blueprint is build up as follows:
- Use inputs for configuring the CPU and memory specs of the node, select the version of Kubernetes and set the IP-range for the load balancer
- Write configuration files for MetalLB and a Kubernetes service account
- Set a new root password and allow root login from SSH
- Install Docker as container runtime
- Install Kubernetes (kubeadm, kubectl, kubelet and kubernetes-cni)
- Disable swap
- Setup Kubernetes cluster using kubeadm
- Export KUBECONFIG file
- Install Weave Net as network overlay for Kubernetes
- Enable (taint) the Master node for scheduling containers
- Install MetalLB for load-balancing
- Install Kubernetes dashboard
- Export Kubernetes certificate
- Export Kubernetes bearer token
- Install Helm
The scalable multi-node cluster blueprint uses the same construct but consists of one Master node and a minimum of one Worker node. In the blueprint this is an extra input to deploy a minimum of 1 and a maximum of 4 Worker nodes, 2 is the default. The Master node is not tainted and therefore can not schedule containers.
The multi-node deployment starts with the Worker node(s), then deploys the Master node and finally joins the Worker node(s) with the cluster. For this, two important scripts are added in the blueprint to “register the nodes” and run the join command.
Once the deployment is successful, the generated token and certificate can be used to register the Kubernetes cluster to vRealize Automation and access the Kubernetes dashboard.
Deploy Kubernetes from Catalog
Once you imported the Kubernetes blueprints in Cloud Assembly, change them accordingly to fit your environment. Then version, release and add them to the Service Broker catalog.
First request a single-node Kubernetes cluster for dev/test.
- Go to the Service Broker catalog and request the single-node Kubernetes cluster.
- Enter a deployment name, select your project, select the size of the master node and Kubernetes version. Finally enter an IP-range for the MetalLB load balancer.
- After a successful deployment, use SSH to logon to the console of the master node and check if the Kubernetes cluster is installed properly by running the following commands:
- A certificate and bearer token are automatically created and available on the master node. These can be used to register the Kubernetes cluster in Cloud Assembly.
- In Cloud Assembly, select the Infrastructure tab. In the left menu, under Resources, select Kubernetes. Then select Add External.
- Enter a name, the address of the cluster (https://<MASTER NODE IP>:6443) and the certificate. Make sure to select Global for Sharing. Select your location and optional your Cloud proxy. Select Bearer token as Credentials type and enter the token. Click Validate, then Save.
- Once added, click on Open to see the details of the cluster like node configuration and namespaces. Also from here, you can download the kubeconfig file to get access to the cluster. This kubeconfig file can also be downloaded from the deployment details.
Create a Kubernetes zone
Requesting and deploying Kubernetes clusters using the self-service catalog is one use case.
For the second use case, requesting Kubernetes namespaces, we need to have a Kubernetes zone added to a project.
- In Cloud Assembly, select the Infrastructure tab. Under Configure, select Kubernetes Zones.
- Add a new Kubernetes zone. Select the All external clusters account and enter a name for the zone.
- Select the Clusters tab and add the deployed single-node and multi-node cluster.
- Also add tags to the clusters to be used in your namespace blueprint. For example, env:dev and env:prod
- Finally, add the Kubernetes zone to your project.
Requesting Kubernetes namespaces
Import the Kubernetes namespace blueprint in Cloud Assembly, change it accordingly to fit your environment. Then version, release and add it to the Service Broker catalog and request it.
- Enter a deployment name, select your project and select which Kubernetes environment to configure the namespace. Enter a name for the namespace and select the memory resource quota limit.
- Once successfully deployed, you can get the kubeconfig file from the deployment details to access to Kubernetes cluster namespace.
- Details of the namespace can be verified by using SSH to logon to the console of the master node and running the following commands:
- This can also be verified in Cloud Assembly by opening the cluster details and selecting the Namespace tab.
In this blog I showed you how easy it is to do Kubernetes as a Service by requesting and deploying Kubernetes Clusters and Namespaces using the self-service catalog in Service Broker and manage them through Cloud Assembly.
In some follow up blogs I’ll explain how to monitor these clusters using vRealize Operations and Log Insight and use them as end-point in Code Stream delivery pipelines for deploying modern applications.
Other articles in the series vRealize Automation:
- Infoblox & vRealize Automation, Setup IPAM endpoint
- Infoblox & vRealize Automation, Install Infoblox IPAM plugin
- Setup provisioning of vCloud Air workloads
- Setup a vCloud Air Endpoint in vRealize Automation
- Setup Postgres database high availability for vRealize Automation
- Setup vRealize Automation Cost profiles & currency
- Speed up vRealize Automation life cycle updates
- Configure vRealize Automation not to delete virtual machines
- Track infrastructure changes with vRealize Automation Data Collection
- MS SQL high availability support for vRealize Automation
- Setup the vRealize Automation prerequisites for IaaS
- vRealize Automation: How to …
- Downgrade the vRealize Automation license
- vRealize Automation 7 – New Architecture & Installation
- vRealize Automation 7 – Improved Authentication
- vRealize Automation 7 – Converged Blueprints
- vRealize Automation 7 – LifeCycle Extensibility
- How to transfer vRealize Automation payload to Orchestrator
- Automation is not difficult with vRealize Automation 7
- vRA custom host name using Orchestrator and Event Broker
- How to deliver Database-as-a-Service with vRealize Automation
- Prepare Windows for vRA software deployment
- Missing endpoints after upgrading to vRealize Automation 7.3
- How to run Containers as a Service – Part 1
- How to run Containers as a Service – Part 2
- Infoblox & vRealize Automation, IP Address Management (IPAM) made easy
- How to run Containers as a Service – Secure Docker communications
- Create a new database user using vRealize Automation XaaS
- Infoblox & vRealize Automation, Infoblox NIOS setup
- Infoblox & vRealize Automation, vRA setup
- vRealize Automation failed requests monitoring
- vRealize Automation 7.2 released
- How to specify a deployment target when using vRealize Automation
- vRealize Suite just became a lot easier with Lifecycle Manager
- LAMP Stacks made easy with VMware and Puppet
- How to: Deploy vRealize Automation 8
- Create Custom Names with vRealize Automation 8
- Kubernetes as a Service