top of page
Search

NSX Application Platform Setup: Part 2 - Kube config file and MetalLB Load Balancer setup

In the previous part we discussed on how to setup the TCE environment to deploy NSX application platform. Quick recap:

- We Configured the DHCP server to assign IPs to TCE Nodes

- Deployed the k8nappclst: the NAPP k8s worker cluster


Let's take a quick look at our planned NAPP k8s network setup:



Let's refer back to the NAPP requirements at this link: https://docs.vmware.com/en/VMware-NSX/4.0/nsx-application-platform/GUID-D54C1B87-8EF3-45B3-AB27-EFE90A154DD3.html . We can see under the service name (FQDN) requirements that the Kubernetes cluster infrastructure that we are using must be able to assign a static IP address and this is where we use the MetalLB load balancer. This is an accepted configuration as per the NAPP requirements page:

Before we dive into deploying the MetalLB, let use first setup our kubernetes cluster context. In k8s world, context is used to group access parameters under an easily recognizable name in a kubeconfig file. It is a "connection" used by kubectl to interact with a particular k8s cluster. By default, the TCE installer inserts the admin context to our k8s cluster. Let us load the admin context for accessing the NAPP cluster "k8nappclst":

tanzu cluster kubeconfig get <k8s cluster namespace> --admin

Now let us create the kube config file using the admin context. We will be using the kube config file later on during the NAPP deploy process. Let us load the admin context on the k8nappclst using the following command:

kubectl use-context k8nappclst -admin@k8nappclst

Now we shall directly use the instructions on the NAPP website to generate the kube config file:

https://docs.vmware.com/en/VMware-NSX-T-Data-Center/3.2/nsx-application-platform/GUID-52A52C0B-9575-43B6-ADE2-E8640E22C29F.html

The kubeconfig file would be generated in the k8nappkubeconfig.yaml file using the above process.

Finally, we setup the MetalLB into our kubernetes cluster. We will be using the k8napp admin context for doing this. We use the commands below for setting up the MetalLB:

kubectl config use-context k8nappclst -admin@k8nappclst
kubectl apply -f https://raw.githubusercontent.com/metallb/metallb/v0.12.1/manifests/namespace.yaml kubectl apply -f https://raw.githubusercontent.com/metallb/metallb/v0.12.1/manifests/metallb.yaml 

The MetalLB has now been deployed, however we need to further configure our MetalLB so that it can work as address allocating load balancer in our desired subnet. For this, you can use the sample config file shown below:

apiVersion: v1
kind: ConfigMap
metadata:
  namespace: metallb-system
  name: config
data:
  config: |
    address-pools:
    - name: default
      protocol: layer2
      addresses:
      - <IPadress range allocated for kubernetes nodes>

Save the above file as 'metallb-config.yaml' and then run the following command:

kubectl apply -f ~/metallb-config.yaml

With this, we have completed the setup of MetalLB in our Kubernetes cluster environment. Stay tuned for the next part!!

80 views0 comments
bottom of page