Objective
This guide documents how to create a Workload cluster and add applications to it.
Requirements
- Being an administrative contact of your Hosted Private Cloud infrastructure to receive login credentials
- A user account with access to the OVHcloud Control Panel
- A user account with access to vSphere
- You need to have the Tanzu Kubernetes GRID administration cluster installed, using the Install Tanzu Kubernetes Grid guide.
- A VLAN with Internet access and a DHCP server
- You must have these resources:
- 16 GB memory, 4 vCPU, 40 GB storage per Kubernetes node (requires 6 nodes per Workload cluster in production mode).
Instructions
We will deploy a Workload cluster on a Tanzu Kubernetes Grid management cluster and add an application.
At the end of the installation, you will have six new virtual machines in addition to the seven that are required for the management cluster to work.
Deploying a Workload cluster
The Workload cluster can be deployed on the same network as the administration cluster or on another network. In our case, we will deploy it on the same network for demonstration purposes. If you want to change networks, simply put the port group in the same configuration YAML of your workload cluster, as explained below in the VSPHERE_NETWORK
section. Ensure that the management cluster can communicate with the workload cluster.
Once you have added this cluster, you can then install applications.
Copy the file that was used to create the administration cluster into a file named tkg-workload-cluster.yaml.
cp ~/.config/tanzu/tkg/clusterconfigs/tkgmfile.yaml ~/tkg-workload-cluster.yaml
Edit the contents of the ~/tkg-workload-cluster.yaml file by changing these values:
CLUSTER_NAME:tkg-workload-clusterVSPHERE_CONTROL_PLANE_ENDPOINT:192.168.0.11
Run this command to create the cluster:
tanzu cluster create --file tkg-workload-cluster.yaml
Connect to the cluster with these commands:
# Authorisation of cluster connection
tanzu cluster kubeconfig get tkg-workload-cluster --admin
# Positioning on tkg-workload-cluster cluster# Administrative accounts always have this form clustername-admin@clustername
kubectl config use-context tkg-workload-cluster-admin@tkg-workload-cluster
Log in to your vSphere interface to see the six virtual machines in the Workload cluster.
Load Balancer installation
The Load Balancer links the Workload cluster network to the external network on the VMware cluster. To do this, we will use the kube-vip package, which will act as a load balancer between the internal network of the cluster and the VLAN 10 network. You can find more information on the kube-vip documentation.
Run these commands from the Bootstrap virtual machine:
# Creating a folder to host the kube-vip application from git
mkdir ~/kube-vip
# Moving into this foldercd ~/kube-vip
# Data recovery from GitHub
git clone https://github.com/vrabbi/tkgm-customizations.git
# Moving to the application subfoldercd tkgm-customizations/carvel-packages/kube-vip-package/
# Applying pre-configuration
kubectl apply -n tanzu-package-repo-global -f metadata.yml
kubectl apply -n tanzu-package-repo-global -f package.yaml
Create the file ~/kube-vip/tkgm-customizations/carvel-packages/kube-vip-package/values.yaml with this content that corresponds to the IP addresses that can be used on VLAN 10 to deploy an application.
vip_range:192.168.0.210-192.168.0.250
Install the package using these commands:
# Installation
tanzu package install kubevip -p kubevip.terasky.com -v 0.3.9 -f values.yaml
# Checking for the kubevip package
kubectl get packages -A
Installing an application
For demonstration purposes, we will deploy an application named yelb that uses 4 pods, one of which will be available via the kubevip load balancer. you can find more information on this exampleKUBERNETESYELB.
Run these commands to install a new application in the Workload cluster from the Bootstrap virtual machine.
# Creating a namespace for this application
kubectl create ns yelb
# Deploying the application from a source on the Internet
kubectl\
-n yelb apply -f\
https://raw.githubusercontent.com/lamw/yelb/master/deployments/platformdeployment/Kubernetes/yaml/yelb-k8s-loadbalancer.yaml
# Checking that the application is properly installed
kubectl get all -n yelb
The IP addresses internal to the KUBERNETES cluster appear in the CLUSTER-IP column, applications that are visible from outside the cluster have an IP address in the EXTERNAL-IP column.
In this example, the website is accessible via the address 192.168.0.223 on port 80.
In the Bootstrap console, use the web browser to connect to the URL http://192.168.0.223
.
An application can consist of multiple pods that communicate with each other through the internal network of the workflow cluster. Some ports are opened on the VMware cluster network using the kube-vip module.