How to deploy Kong locally on K8S with Ingress

How to deploy Kong locally on K8S with Ingress

My goal is to deploy kong as an api-gateway and ingress-controller locally and test out its ingress and gateway (e.g. rate-limiting) capabilities. I am facing issues in deploying kong-ingress locally on k3s. Anyone here who can help out?


Hello! How are you?
here are the general steps to deploy Kong locally on a Kubernetes cluster with Ingress:

  1. Install Kubernetes locally on your machine. You can use a lightweight distribution like k3s if you want to minimize resource usage.

  2. Install and configure Helm, which is a package manager for Kubernetes. You’ll use Helm to deploy Kong and its dependencies.

  3. Add the official Kong Helm repository to your local Helm installation using the following command:

helm repo add kong [](
  1. Update your local Helm repository cache using the following command:
helm repo update
  1. Create a new namespace in your Kubernetes cluster where you’ll deploy Kong:
kubectl create namespace kong
  1. Install Postgres using the Bitnami Helm chart. Kong requires a database to store configuration and other data:
helm install postgresql bitnami/postgresql --namespace kong
  1. Install Kong using the official Helm chart. This will create a deployment for Kong and a service to expose it:
helm install kong kong/kong --namespace kong
  1. Verify that Kong is running by checking the logs for the Kong pod:
kubectl logs -f KONG_POD_NAME -n kong

Replace KONG_POD_NAME with the actual name of the Kong pod in your cluster.

  1. Deploy an example application that uses Kong as an ingress controller. You can use any application you want. Here’s an example deployment file that deploys the default nginx welcome page:
apiVersion: apps/v1
kind: Deployment
    app: nginx
  name: nginx
  replicas: 1
      app: nginx
        app: nginx
      - image: nginx:latest
        name: nginx
        - containerPort: 80
apiVersion: v1
kind: Service
    app: nginx
  name: nginx-service
    app: nginx
  - name: http
    port: 80
    targetPort: 80
  1. Create an ingress resource that uses Kong as the ingress controller. Here’s an example ingress file that routes traffic to the nginx welcome page:
apiVersion: [](
kind: Ingress
  name: kong-ingress
    []( kong
  - host: []( # change this to your own hostname
      - path: /nginx
          serviceName: nginx-service
          servicePort: http
  1. Apply the deployment and ingress files to your Kubernetes cluster using the following commands:
kubectl apply -f nginx.yaml
kubectl apply -f ingress.yaml
  1. Verify that the nginx welcome page is accessible through Kong by navigating to http://<KONG_IP_ADDRESS>/nginx in your web browser, where KONG_IP_ADDRESS is the IP address of the node running the Kong pod.

That’s it! You should now have Kong set up as an API gateway and ingress controller on your local Kubernetes cluster, and you should be able to test out its features like rate-limiting by modifying the application and ingress resources as needed.

I get an error

ensure CRDs are installed first```
If I try to change the `apiVersion` to `[](` I get a different error
```Error from server (BadRequest): error when creating "kong-ingress.yaml": Ingress in version "v1" cannot be handled as a Ingress: strict decoding error: unknown field "spec.rules[0].http.paths[0].backend.serviceName", unknown field "spec.rules[0].http.paths[0].backend.servicePort"```