Install Kong Operator for multi-tenancy

TL;DR

Install Kong Operator with env.watch_namespace scoped to your tenant namespaces, then apply a single KongLicense in kong-system.

Prerequisites

Save your Kong Gateway Enterprise license as license.json in your current working directory. If you don’t have a license, contact your Kong representative.

This series deploys two independent Kong Gateway instances — one public-facing, one private — on the same cluster using a single Kong Operator installation. Each gateway is scoped to its own namespace so that its in-memory KIC only processes routes from that namespace.

The following diagram shows the end state you’ll build across this series:

 
flowchart TB
  subgraph cluster["Kubernetes Cluster"]
    subgraph sys["kong-system"]
      KO["Kong Operator\n(KongLicense)"]
    end

    subgraph pub["kong-gw-public"]
      ConfigPub["GatewayConfiguration\nwatchNamespaces: own"]
      GWPub["Gateway: gw-public"]
      DPPub["Data plane Pod"]
      SvcPub["echo service\nHTTPRoute /echo"]
    end

    subgraph priv["kong-gw-private"]
      ConfigPriv["GatewayConfiguration\nwatchNamespaces: own"]
      GWPriv["Gateway: gw-private"]
      DPPriv["Data plane Pod"]
      SvcPriv["echo service\nHTTPRoute /echo"]
    end

    KO -->|manages| GWPub
    KO -->|manages| GWPriv
    ConfigPub -.->|configures| GWPub
    ConfigPriv -.->|configures| GWPriv
    GWPub -->|provisions| DPPub
    GWPriv -->|provisions| DPPriv
    DPPub -->|routes traffic to| SvcPub
    DPPriv -->|routes traffic to| SvcPriv
  end
  

Create namespaces

Create the system namespace and the two tenant namespaces:

kubectl create namespace kong-system
kubectl create namespace kong-gw-public
kubectl create namespace kong-gw-private

Install Kong Operator

  1. Add the Kong Helm chart repository:

    helm repo add kong https://charts.konghq.com
    helm repo update
  2. Install Kong Operator scoped to the two tenant namespaces. The watch_namespace value prevents the operator from reconciling resources in any other namespace.

    helm upgrade --install kong-operator kong/kong-operator \
      -n kong-system \
      --create-namespace \
      --set image.tag=2.2 \
      --set env.watch_namespaces="kong-system\,kong-gw-public\,kong-gw-private"
  3. Wait for Kong Operator to be ready:

    kubectl -n kong-system wait --for=condition=Available=true --timeout=120s deployment/kong-operator-kong-operator-controller-manager

Apply a KongLicense

Apply the license once in kong-system. It’s shared by all gateways managed by this operator installation.

echo "
apiVersion: configuration.konghq.com/v1alpha1
kind: KongLicense
metadata:
  name: kong-license
rawLicenseString: '$(cat ./license.json)'
" | kubectl -n kong-system apply -f -

The KongLicense controller runs inside each gateway’s in-memory KIC, so the license won’t reach the Programmed condition until a ControlPlane — deployed on its own or as part of a Gateway — picks it up. You’ll confirm this in Deploy the public gateway after deploying the public gateway.

Help us make these docs great!

Kong Developer docs are open source. If you find these useful and want to make them better, contribute today!