K8GB - Kubernetes Global Balancer

CNCF Sandbox Project

CNCF Coordination & Service Discovery

Join #k8gb on CNCF Slack

License: MIT Build Status Terratest Status Gosec CodeQL Go Report Card Helm Publish KubeLinter Docker Pulls Artifact HUB doc.crds.dev FOSSA Status CII Best Practices

A Global Service Load Balancing solution with a focus on having cloud native qualities and work natively in a Kubernetes context.

Just a single Gslb CRD to enable the Global Load Balancing:

apiVersion: k8gb.absa.oss/v1beta1
kind: Gslb
  name: test-gslb-failover
  namespace: test-gslb
      - host: failover.test.k8gb.io # Desired GSLB enabled FQDN
          - backend:
              serviceName: frontend-podinfo # Service name to enable GSLB for
              servicePort: http
            path: /
    type: failover # Global load balancing strategy
    primaryGeoTag: eu-west-1 # Primary cluster geo tag

Global load balancing, commonly referred to as GSLB (Global Server Load Balancing) solutions, has been typically the domain of proprietary network software and hardware vendors and installed and managed by siloed network teams.

k8gb is a completely open source, cloud native, global load balancing solution for Kubernetes.

k8gb focuses on load balancing traffic across geographically dispersed Kubernetes clusters using multiple load balancing strategies to meet requirements such as region failover for high availability.

Global load balancing for any Kubernetes Service can now be enabled and managed by any operations or development teams in the same Kubernetes native way as any other custom resource.

Key Differentiators

Quick Start

Simply run

make deploy-full-local-setup

It will deploy two local k3s clusters via k3d, expose associated CoreDNS service for UDP DNS traffic), and install k8gb with test applications and two sample Gslb resources on top.

This setup is adapted for local scenarios and works without external DNS provider dependency.

Consult with local playground documentation to learn all the details of experimenting with local setup.

Optionally, you can run make deploy-prometheus and check the metrics on the test clusters (http://localhost:8080, http://localhost:8081).

Motivation and Architecture

k8gb was born out of the need for an open source, cloud native GSLB solution at Absa Group in South Africa.

As part of the bank's wider container adoption running multiple, geographically dispersed Kubernetes clusters, the need for a global load balancer that was driven from the health of Kubernetes Services was required and for which there did not seem to be an existing solution.

Yes, there are proprietary network software and hardware vendors with GSLB solutions and products, however, these were costly, heavyweight in terms of complexity and adoption, and were not Kubernetes native in most cases, requiring dedicated hardware or software to be run outside of Kubernetes.

This was the problem we set out to solve with k8gb.

Born as a completely open source project and following the popular Kubernetes operator pattern, k8gb can be installed in a Kubernetes cluster and via a Gslb custom resource, can provide independent GSLB capability to any Ingress or Service in the cluster, without the need for handoffs and coordination between dedicated network teams.

k8gb commoditizes GSLB for Kubernetes, putting teams in complete control of exposing Services across geographically dispersed Kubernetes clusters across public and private clouds.

k8gb requires no specialized software or hardware, relying completely on other OSS/CNCF projects, has no single point of failure, and fits in with any existing Kubernetes deployment workflow (e.g. GitOps, Kustomize, Helm, etc.) or tools.

Please see the extended architecture documentation here

Internal k8gb architecture and its components are described here

Installation and Configuration Tutorials

Production Readiness

k8gb is very well tested with the following environment options

Type Implementation
Kubernetes Version >= 1.15
Environment Self-managed, AWS(EKS) *
Ingress Controller NGINX, AWS Load Balancer Controller *
EdgeDNS Infoblox, Route53, NS1

* We only mention solutions where we have tested and verified a k8gb installation. If your Kubernetes version or Ingress controller is not included in the table above, it does not mean that k8gb will not work for you. k8gb is architected to run on top of any compliant Kubernetes cluster and Ingress controller.

Presentations Featuring k8gb

KubeCon NA 2021
Crossplane Community Day

#29 DoK Community
AWS Containers from the Couch show
OpenShift Commons Briefings
Demo at Kubernetes SIG Multicluster