Kong on Kubernetes

Kong Course · lesson 13 of 15 · 4 min read

The Ingress Controller turns Kubernetes resources into Kong config for you.

Open this lesson in the learning hub

Key points

  • The Kong Ingress Controller watches the Kubernetes API and configures Kong to match.
  • You write Ingress or Gateway API resources; the controller creates the services and routes.
  • Plugins attach with a KongPlugin resource, referenced by annotation on the ingress.
  • Kong runs DB-less here: the controller is the source of truth, and pods stay stateless and replaceable.
  • So gateway config lives beside your deployment manifests, in the same repo and the same review.

Example

apiVersion: configuration.konghq.com/v1
kind: KongPlugin
metadata:
  name: rate-limit-5
config:
  minute: 5
  policy: local
plugin: rate-limiting
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: orders
  annotations:
    konghq.com/plugins: rate-limit-5
spec:
  ingressClassName: kong
  rules:
    - http:
        paths:
          - path: /orders
            pathType: Prefix
            backend:
              service: { name: orders, port: { number: 8080 } }

On Kubernetes you configure Kong through Kubernetes resources, so gateway config ships with the app.

This is a reading copy. The full lesson — with the visual explainer, the interactive lab and a Run button for the code — lives in the Kong Course course, and every lesson in it is listed on the Kong Course contents page.