Install Kong Operator for Kong AI Gateway

TL;DR

Install Kong Operator using Kong’s kong-operator chart with --set env.ENABLE_CONTROLLER_AIGATEWAYDATAPLANE=true to enable the AI Gateway data plane controller.

Prerequisites

You need a running Kubernetes cluster with kubectl configured to point at it. Any cluster works, whether it runs locally or in a cloud provider.

If you don’t have one, create a local cluster with minikube:

minikube start -p kong-demo

You will need Helm, a package manager for Kubernetes.

If you don’t have a Konnect account, you can get started quickly with our onboarding wizard.

  1. The following Konnect items are required to complete this tutorial:
    • Personal access token (PAT): Create a new personal access token by opening the Konnect PAT page and selecting Generate Token.
  2. Set the personal access token as an environment variable:

    export KONNECT_TOKEN='YOUR KONNECT TOKEN'
Deploying on-prem Kong AI Gateway 2.x with Kong Operator is in Tech Preview. Running Kong AI Gateway with an OnPremAIGateway control plane is not supported for production use, and its resources and behavior may change between releases. It requires Kong Operator 2.4.0-rapid.3.0 or later and a Kong Gateway Enterprise license.

Save a Kong Gateway Enterprise license as license.json in your working directory.

This guide walks through a complete Kong AI Gateway setup using Kong Operator.

By the end of the series, you will have:

  • A Konnect Kong AI Gateway control plane
  • An on-premises Kong AI Gateway control plane run by Kong Operator
  • An AI Model Provider (OpenAI) and an AI Model
  • An Kong AI Gateway data plane running in Kubernetes
  • AI Prompt Guard Policies enforcing content governance
  • Authenticated AI Consumers with per-team API keys

Create the Kubernetes namespace

Create the namespace used throughout this series:

kubectl create namespace kong

Install Kong Operator

Kong AI Gateway features ship in Kong Operator rapid releases. Use Kong Operator 2.4.0-rapid.3.1, chart version 1.5.0-rapid.3.1, or later. Rapid releases are fully supported production releases. For more information, see Rapid releases.

If you want cert-manager to issue and rotate the admission and conversion webhook certificates, install cert-manager to your cluster and enable cert-manager integration by passing the following argument while installing, in the next step:

   --set global.webhooks.options.certManager.enabled=true

If you do not enable this, the chart will generate and inject self-signed certificates automatically. We recommend enabling cert-manager to manage the lifecycle of these certificates. Kong Operator needs a certificate authority to sign the certificate for mTLS communication between the control plane and the data plane. This is handled automatically by the Helm chart. If you need to provide a custom CA certificate, refer to the certificateAuthority section in the values.yaml of the Helm chart to learn how to create and reference your own CA certificate.

Apply a KongLicense. This assumes that your license is available in ./license.json

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

Verify AI Gateway CRDs

Confirm the AI Gateway CRDs are registered in the cluster:

kubectl get crd | grep -E "aigateway|aigatewaydataplane"

You should see entries for konnectaigateways, onpremaigateways, aigatewaymodelproviders, aigatewaymodels, aigatewaypolicies, aigatewayauthstrategies, aigatewayconsumers, aigatewayconsumercredentials, aigatewayconsumergroups, aigatewayagents, aigatewaydataplanecertificates, and aigatewaydataplanes.

Verify the on-premises controller and license

Confirm that the KongLicense was picked up by Kong Operator:

kubectl get konglicense kong-license \
  -o jsonpath='{.status.controllers[0].conditions[?(@.type=="Programmed")].status}'

The command prints True. Kong Operator injects this license into every AIGatewayDataPlane that references an OnPremAIGateway. A data plane started without a license still runs, but reports LicenseValid=False with the message No enabled KongLicense resource found; the gateway will run without a license.

Confirm that the OnPremAIGateway controller is enabled:

kubectl get deployment -n kong-system kong-operator-kong-operator-controller-manager \
  -o jsonpath='{.spec.template.spec.containers[0].env[?(@.name=="KONG_OPERATOR_ENABLE_CONTROLLER_ONPREMAIGATEWAY")].value}'

The command prints true. If it prints nothing, the operator was installed without --set env.ENABLE_CONTROLLER_ONPREMAIGATEWAY=true. An OnPremAIGateway you create in that state is never reconciled and stays at Ready=Unknown.

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!