Kong / charts

Helm chart for Kong
Apache License 2.0
247 stars 477 forks source link

[Kong Ingress Controller Chart] Deploy multiple kong instances and customize the controllerName of GatewayClass. #1079

Closed xiaoronglv closed 3 months ago

xiaoronglv commented 3 months ago

Hi Kong Engineers,

Good day!

I would like to deploy two Kong Gateway Instances to an AWS Kubernetes Cluster (EKS):

  1. Public Kong API Gateway
  2. Internal Kong API Gateway

Install the first Kong Gateway Instance

Kong provides excellent documentation on how to install the Kong Ingress Controller using Helm. The deployment of my public API gateway was very smooth.

Here is the values.yaml file used:

gateway:
  proxy:
    http:
      enabled: true
    tls:
      overrideServiceTargetPort: 8000
    annotations:
      external-dns.alpha.kubernetes.io/aws-zone-type-public: true
      external-dns.alpha.kubernetes.io/hostname: "gateway-kong.example.com"
      service.beta.kubernetes.io/aws-load-balancer-backend-protocol: "http"
      service.beta.kubernetes.io/aws-load-balancer-scheme: "internet-facing" #  πŸ‘ˆ
      service.beta.kubernetes.io/aws-load-balancer-ssl-cert: "arn:aws:acm:us-west-2:****"
      service.beta.kubernetes.io/aws-load-balancer-ssl-ports: "443"
  autoscaling:
    enabled: true

Here is the command to install the public API gateway:

 helm install kong kong/ingress -n kong --values ./values.yml --create-namespace

After installation, I defined the GatewayClass with the default controllerName konghq.com/kic-gateway-controller:

apiVersion: gateway.networking.k8s.io/v1
kind: GatewayClass
metadata:
  name: kong
  annotations:
    konghq.com/gatewayclass-unmanaged: 'true'
spec:
  controllerName: konghq.com/kic-gateway-controller #  πŸ‘ˆ

Everything works fine

Install second Kong Gateway Instance

After installing the public kong gateway, I started to install the second kong gateway instance as the internal API gateway instance. I need to specify a new controllerName: konghq.com/kic-gateway-controller-private. Then I could reference the controllerName when define the GatewayClass for internal purpose.

apiVersion: gateway.networking.k8s.io/v1
kind: GatewayClass
metadata:
  name: kong
  annotations:
    konghq.com/gatewayclass-unmanaged: 'true'

spec:
  controllerName: konghq.com/kic-gateway-controller-internal  #  πŸ‘ˆ

However, I couldn't find any values.yaml example in the codebase that illustrates how to customize the controllerName for the gateway class, which is crucial for deploying multiple Kong gateway instances.

The documentation "Using Custom Classes to split Internal/External traffic" seems stale and the parameter controller.ingressController.ingressClass recommend by the documentation seems not working.

Question

  1. How to customize the controllerName of GatwayClass in the values.yaml when using the kong ingress controller chart?

  2. could you please provide a values.yaml example in this examples folder?

Thank you!

Reference

  1. Github: Kong / Charts / charts / ingress / example-values
  2. Using Custom Classes to split Internal/External traffic
  3. Github Issues: Document how to support multiple GatewayClass instances
xiaoronglv commented 3 months ago

@czeslavo

Could you please take a look when you get the time?

when installing the kong though helm, how to specify the gateway-api-controller-name ?

pmalek commented 3 months ago

@xiaoronglv when using the ingress chart you should be able to do that via

gateway:
  proxy:
    ... my values

controller:
  ingressController:
    env:
      gateway_api_controller_name: name
pmalek commented 3 months ago

@xiaoronglv I'm going to close this one. If there's still something you'd like us to look at, don't hesitate to write.

xiaoronglv commented 3 months ago

Thank you, @pmalek !

Your solutions works really well!