Kong

Kong is a cloud-native, open-source API gateway and Kubernetes ingress controller. It provides advanced routing, security, and observability features for microservices and APIs. Kong is widely used in AWS, Azure, GCP, and hybrid environments for managing north-south traffic, API management, and integrating legacy and modern workloads.


Key Features

  • Ingress routing: Use Ingress resources to configure Kong for HTTP, HTTPS, and gRPC traffic.

  • API management with plugins: Monitor, transform, secure, and rate-limit traffic using Kong plugins.

  • Native gRPC support: Proxy and secure gRPC traffic with full plugin support.

  • Health checking & load balancing: Distribute requests across pods with active and passive health checks.

  • Request/response transformations: Modify traffic on the fly using plugins.

  • Authentication: Protect services with JWT, OAuth2, key-auth, and more.

  • Declarative configuration: Manage Kong using Kubernetes CRDs for GitOps and automation.

  • Gateway Discovery: Monitor and push config to all Kong Gateway replicas.


Installation

YAML (quick start):

kubectl apply -f https://raw.githubusercontent.com/Kong/kubernetes-ingress-controller/latest/deploy/single/all-in-one-dbless.yaml

Helm (recommended for production):


Real-Life Example: Exposing a Microservice with Kong

1. Set the Kong Proxy IP

Get the external IP of the Kong proxy service:

2. Test Kong Gateway Connectivity

Expected: HTTP 404 Not Found (no route configured yet)

3. Deploy an Upstream HTTP Application

Deploy a simple echo server:

4. Create an IngressClass (if needed)

5. Add Routing Configuration

Create an Ingress to route /echo to the echo service:

Test the route:


Real-Life Example: Securing and Rate-Limiting with Plugins

1. Enable a Plugin (e.g., Correlation ID)

Annotate the Ingress to use the plugin:

2. Enable Rate Limiting on a Service

Annotate the Service:

Test the rate limit:


Best Practices

  • Use Helm for repeatable, versioned Kong deployments

  • Store all configuration (Helm values, CRDs, plugins) in Git for GitOps

  • Use plugins for authentication, rate limiting, and observability

  • Monitor Kong and application health with Prometheus/Grafana

  • Restrict external access with network policies and firewalls


References

Tip: Integrate Kong with CI/CD (GitHub Actions, ArgoCD, Flux) for automated API gateway and ingress management in multi-cloud environments.

Last updated