Deploy the public gateway
Create a GatewayConfiguration with controlPlaneOptions.watchNamespaces.type: own,
then create the matching GatewayClass and Gateway in the tenant namespace.
Prerequisites
Series Prerequisites
This page is part of the Deploy multiple isolated gateways on the same cluster series.
Complete the previous page, Install Kong Operator for multi-tenancy before completing this page.
Create a GatewayConfiguration
The controlPlaneOptions.watchNamespaces.type: own field restricts the in-memory KIC for this gateway to watch only the kong-gw-public namespace. Without this, it would watch all namespaces and process routes belonging to other tenants.
echo '
kind: GatewayConfiguration
apiVersion: gateway-operator.konghq.com/v2beta1
metadata:
name: gw-public
namespace: kong-gw-public
spec:
dataPlaneOptions:
deployment:
podTemplateSpec:
spec:
containers:
- name: proxy
image: kong/kong-gateway:3.15
controlPlaneOptions:
watchNamespaces:
type: own
' | kubectl apply -f -Create a GatewayClass
-
Create a
GatewayClassthat references theGatewayConfigurationabove:echo ' kind: GatewayClass apiVersion: gateway.networking.k8s.io/v1 metadata: name: gw-public spec: controllerName: konghq.com/gateway-operator parametersRef: group: gateway-operator.konghq.com kind: GatewayConfiguration name: gw-public namespace: kong-gw-public ' | kubectl apply -f - -
Wait for Kong Operator to accept the
GatewayClass:kubectl wait --for=condition=Accepted=True gatewayclass/gw-public --timeout=60s
Create a Gateway
-
Create the
Gatewayresource in thekong-gw-publicnamespace, referencing theGatewayClassabove:echo ' kind: Gateway apiVersion: gateway.networking.k8s.io/v1 metadata: name: gw-public namespace: kong-gw-public spec: gatewayClassName: gw-public listeners: - name: http protocol: HTTP port: 80 ' | kubectl apply -f - -
Wait for the gateway to be programmed:
kubectl wait --for=condition=Programmed=True gateway/gw-public -n kong-gw-public --timeout=120s -
This gateway’s in-memory KIC is the first
ControlPlanein the cluster, so it’s the one that picks up theKongLicenseyou applied in the previous step. Confirm it reached theProgrammedcondition:kubectl wait --for=jsonpath='{.status.controllers[0].conditions[0].status}'=True \ konglicense/kong-license --timeout=60s
Validate
Verify the public gateway was reconciled successfully:
You can verify the Gateway was reconciled successfully by checking its Programmed condition.
kubectl get -n kong-gw-public gateway gw-public \
-o=jsonpath='{.status.conditions[?(@.type=="Programmed")]}' | jqThe output should look similar to this:
{
"observedGeneration": 1,
"reason": "Programmed",
"status": "True",
"type": "Programmed"
}