Auto Provisioning Kubernetes LoadBalancer Services with F5
Learn how to configure a Kubernetes cluster to provision a service of type LoadBalancer with F5 BIG-IP
When deploying Kubernetes clusters in the cloud (AWS, Azure, GCP etc.) a Kubernetes service of type LoadBalancer is by default provisioned automatically by the appropriate cloud controller manager using the native load-balancer service (e.g. ELB on AWS). It’s not the same for on-premise clusters, which require additional components to be deployed/configured to get this functionality. There are a few Kubernetes native options like metallb and kube-vip. However, for production clusters and clusters that process heavy traffic, an external load-balancer might be a better choice. F5 BIG-IP LTM is one of the most widely used load-balancers in the industry today and the best thing is that it integrates really nicely with Kubernetes.
In this blog we will see how to configure an on-premise Kubernetes cluster to integrate with F5 BIG-IP LTM to provision a service of type LoadBalancer
.
Integrating a Kubernetes Cluster With F5
Requirements
- Pre-configured F5 BIG cluster
- F5 Partition that will be managed by this automation along with credentials for a service account that has admin permissions for the given partition
- AS3 3.39 or newer installed on the F5 cluster
- IP’s availble to be used as VIPs for Virtual Server instances
- Working Kubernetes cluster with PV Storage configured
- If using the CAPI steps then a CAPI bootstrap/management cluster and configurations to deploy a cluster. Refer DKP documentation for more details.
- This uses
docker.io/f5networks/f5-ipam-controller:0.1.5
for FIC &docker.io/f5networks/k8s-bigip-ctlr:2.9.1
for CIS capabilities. Download, retag and push the images to a local registry and change the deployment spec to point to a local image registry for airgapped environments.
This blog used the following versions to test:
- BIG-IP: 16.1.3.1 Build 0.0.11 Point Release 1
- AS3: v3.39.0
- BIG-IP-CTLR: 2.9.1
Steps to Integrate a Kubernetes Cluster With F5 BIG-IP
There are two options based on whether F5 controllers are to be directly deployed to the target cluster, or deployed via ClusterResourceSets
for a CAPI provisioned cluster either at cluster creation time or after the cluster has been deployed.
Option 1: Directly Deploy F5 Controllers to a Kubernetes Cluster
Step 1: Deploy F5 Big IP Container Ingress Services (CIS)
- Add Helm Repo
|
|
- Create Values Yaml
|
|
- Install
|
|
Step 2: Deploy F5 IPAM Controller (FIC)
- Add Helm Repo
|
|
- Create Values Yaml
|
|
The RANGE variable contains key/value pairs for labels and the IP ranges to be served by the IPAM controller. The range used here should be a valid reserved IP range.
- Install
|
|
Option 2: Deploy Automatically via CAPI
Note: If deploying to a CAPI provisioned Kubernetes Cluster like DKP instead of running the install command manually, the above can be packaged into a CAPI ClusterResourceSet by doing the following and incorporated into the cluster deployment process.
Pre-Step
Create a directory with the name of the cluster and move to that directory so that all the artifacts are generated there
If not already done generate CAPI cluster manifest.
Hint: Use DKP to easily generate one
Step 1: Deploy F5 Big IP Container Ingress Services (CIS)
Note: Ensure that KUBECONFIG is pointing to the bootstrap/management cluster that is managing the lifecycle of the target cluster to which the F5 controllers are being deployed
The above will generate
f5-cluster-resoureset-${CLUSTER_NAME}.yaml
Step 2: Deploy F5 IPAM Controller (FIC)
The above will generate
f5-ipam-cluster-resoureset-${CLUSTER_NAME}.yaml
Now deploy the f5-cluster-resoureset-${CLUSTER_NAME}.yaml
and ``f5-ipam-cluster-resoureset-${CLUSTER_NAME}.yaml
manifest created above to the CAPI bootstrap/management cluster using kubectl create -f
command along with the new cluster specs (i.e. the specs created using the dkp create cluster
command).
e.g.
|
|
This will deploy the cluster along with the F5 controllers fully configured
Test
Once the cluster is deployed successfully test by deploying an nginx service
Set KUBECONFIG to point to the target managed cluster where the F5 controllers where deployed.
If using DKP the kubeconfig of the cluster can be retrieved by using the following command
Now deploy the test service
|
|
- Verify
|
|
Sample Output
Optionally login to F5 portal and verify
Test Service via Loadbalancer VIP (i.e. using the value of the EXTERNAL-IP
field)
|
|
So, we now have an on-premise Kubernets cluster tightly integrated with F5 BIG-IP that will react to the lifecycle of services of type LoadBalancer created in the cluster (optionally configured to only do this for certain namespaces).
In this blog we saw the options to provision a Kubernetes services of type LoadBalancer in an on-premise cluster and how easy it is to configure a cluster to do this using F5 BIG-IP.