WilliamLam.com

  • About
    • About
    • Privacy
  • VMware Cloud Foundation
  • VKS
  • Homelab
    • Resources
    • Nested Virtualization
  • VMware Nostalgia
  • Apple
You are here: Home / VMware Tanzu / Quick Tip - Install Metallb as service load balancer with Tanzu Community Edition (TCE)

Quick Tip - Install Metallb as service load balancer with Tanzu Community Edition (TCE)

10.18.2021 by William Lam // 1 Comment

There have been a few questions in the community asking about service load balancer options when using Tanzu Community Edition (TCE). Out of the box, TCE does support NSX Advanced Load Balancer (NSX-ALB), but most folks will probably not have access to NSX-ALB or the resources to set that up. As an alternative, either kube-vip and metallb can be used and they are completely free and easy to setup.

I personally have used metallb before and I definitely recommend it for its ease of use and setup. You can find the instructions below on setting up metallb with TCE along with a sample kubernetes (k8s) application to verify its functionality.

Note: Scott Rosenberg is also doing some interesting stuff with Carvel that would enable easy deployment of kube-vip and metallb in TCE. I am hoping I will get some time to take a look at this setup as I think this would be great user experience for TCE just like you can install other k8s applications.

Step 1 - Install metallb into your TCE Workload Cluster:

kubectl apply -f https://raw.githubusercontent.com/metallb/metallb/v0.10.3/manifests/namespace.yaml
kubectl apply -f https://raw.githubusercontent.com/metallb/metallb/v0.10.3/manifests/metallb.yaml

Step 2 - Create the metallb configuration which will define the IP Address range that will be allocated for load balancer requests:

cat > metallb-config.yaml <<EOF
apiVersion: v1
kind: ConfigMap
metadata:
  namespace: metallb-system
  name: config
data:
  config: |
    address-pools:
    - name: default
      protocol: layer2
      addresses:
      - 192.168.30.240-192.168.30.241
EOF

Step 3 - Install the metallb ConfigMap:

kubectl apply -n metallb-system -f metallb-config.yaml

Verify that all metallb Pods are running:

kubectl -n metallb-system get pods


Step 4 - Deploy sample k8s application that uses service type load balancer such as the famous Yelb application:

kubectl create ns yelb
kubectl -n yelb apply -f https://raw.githubusercontent.com/lamw/yelb/master/deployments/platformdeployment/Kubernetes/yaml/yelb-k8s-loadbalancer.yaml

Verify that all Yelb Pods are running:

kubectl -n yelb get pods


Step 5 - Verify Yelb application has allocated an IP Address out of the metallb address range:

kubectl -n yelb get svc


Step 6 - Open a browser to the IP Address shown from the previous step and if everything was configured successfully, you should see the following:

More from my site

  • vSphere Event-Driven Automation using Tanzu Application Platform (TAP) on Tanzu Community Edition
  • Cluster API BYOH Provider on Photon OS (Arm) with Tanzu Community Edition (TCE) and ESXi-Arm
  • Hybrid (x86 and Arm) Kubernetes clusters using Tanzu Community Edition (TCE) and ESXi-Arm
  • Quick Tip - Install kube-vip as service load balancer with Tanzu Community Edition (TCE)
  • Minimum vSphere edition & features for Tanzu Community Edition (TCE)

Categories // VMware Tanzu Tags // metallb, Tanzu Community Edition

Comments

  1. *protectedIan Koenig says

    12/17/2021 at 10:42 am

    Any suggestions on why it doesn't work with MetalLB 0.11 & TCE 0.9.1 with k8s 1.21.1?

    Reply

Leave a Reply to Ian KoenigCancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Search

Thank Author

Author

William is Distinguished Platform Engineering Architect in the VMware Cloud Foundation (VCF) Division at Broadcom. His primary focus is helping customers and partners build, run and operate a modern Private Cloud using the VMware Cloud Foundation (VCF) platform.

Connect

  • Bluesky
  • Email
  • GitHub
  • LinkedIn
  • Mastodon
  • Reddit
  • RSS
  • Twitter
  • Vimeo

Recent

  • Programmatically accessing the Broadcom Compatibility Guide (BCG) 05/06/2025
  • Quick Tip - Validating Broadcom Download Token  05/01/2025
  • Supported chipsets for the USB Network Native Driver for ESXi Fling 04/23/2025
  • vCenter Identity Federation with Authelia 04/16/2025
  • vCenter Server Identity Federation with Kanidm 04/10/2025

Advertisment

Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.
To find out more, including how to control cookies, see here: Cookie Policy

Copyright WilliamLam.com © 2025

 

Loading Comments...