Kong Helm Charts

repository·main·Indexed 43 days ago

https://github.com/kong/charts

Official Helm charts for deploying Kong on Kubernetes. Includes charts for the Kong Gateway, Kong Ingress Controller (KIC), Kong Gateway Operator, and Kong AI Gateway, as well as management for Gateway API standard and experimental CRDs.

Tokens
27.5K
Snippets
76
Records
109
Agent score
55%

What's inside Kong Helm Charts

  1. Manage CRDs for the Kong Gateway Operator

    main

    The Kong Gateway Operator chart uses Helm 3's CRD management strategy.

    Key behaviors:

    • Installation: CRDs are created during the initial installation if they are not already present.
    • Upgrades/Deletes: CRDs are not automatically modified or deleted during release upgrades or deletes.

    Important Notes:

    • If a chart release requires manual CRD updates, these changes will be explicitly mentioned in the release notes.
    • For manual update instructions, refer to UPGRADE.md in the repository.
    • If you choose to manage CRDs automatically (outside of this Helm strategy), ensure you have backups of all associated custom resources to prevent data loss during unintended CRD deletions.

    CRD Sources: The operator utilizes CRDs from the following sources:

    • Gateway API
    • Kong Kubernetes Configuration
    • Gateway Operator CRDs
  2. Use Gateway Discovery to dynamically locate Gateway instances

    main

    Kong Ingress Controller v2.9+ supports Gateway Discovery, which allows the controller to dynamically discover Gateway instances via a Kubernetes Admin API service. This requires a split release installation where Gateways and the Ingress Controller are deployed separately.

    Configuration Options

    Enable or disable the feature using ingressController.gatewayDiscovery.enabled:

    • false (default): The controller manages a pre-determined set of Gateways using the CONTROLLER_KONG_ADMIN_URL environment variable.
    • true: The controller dynamically locates Gateways by watching a specified Kubernetes service via the CONTROLLER_KONG_ADMIN_SVC environment variable.

    Required Service Flags

    If enabled is true, you must specify the Admin API Service details:

    • ingressController.gatewayDiscovery.adminApiService.name: The name of the service.
    • ingressController.gatewayDiscovery.adminApiService.namespace: The namespace of the service.
    • ingressController.gatewayDiscovery.generateAdminApiService: If set to true, the chart automatically generates the name and namespace based on the current Helm release name and namespace. This is recommended when using the kong chart as a subchart.

    DNS Strategy for Gateway Addresses

    You can control how Gateway addresses are generated using the CONTROLLER_GATEWAY_DISCOVERY_DNS_STRATEGY environment variable (or the --gateway-discovery-dns-strategy CLI flag).

    Supported values:

    • service: Uses service-scoped pod DNS names (pod-ip-address.service-name.my-namespace.svc.cluster-domain.example).
    • pod: Uses namespace-scoped pod DNS names (pod-ip-address.my-namespace.pod.cluster-domain.example).
    • ip (default): Uses regular IP addresses.
    ingressController:
      gatewayDiscovery:
        enabled: true
        adminApiService:
          name: my-admin-service
          namespace: kong-namespace
        generateAdminApiService: false
  3. Argo CD Deployment Considerations

    main

    When deploying Kong via Argo CD, be aware of the following:

    1. Database Subchart: The built-in postgresql subchart (postgresql.enabled) is not supported when installing via Argo CD.
    2. Migration Jobs: Argo CD does not distinguish between initial installs and upgrades (both are treated as "sync"). This affects when init-migrations and pre-upgrade-migrations Jobs run.
    3. Hook Policies: To ensure migrations run correctly in Argo CD environments, the chart uses Sync and BeforeHookCreation deletion hook policies. Specifically, pre-upgrade-migrations is set to the Sync policy so it starts at the same time as upgraded Deployment Pods, preventing failures caused by missing dependencies (like ServiceAccounts) during a PreSync phase.
  4. Understand the Kong chart upgrade process

    main

    The Kong chart automates migrations using a specific lifecycle during helm upgrade:

    1. An initial job runs kong migrations up.
    2. New Kong pods with the updated version are spawned.
    3. Once new pods are ready and processing traffic, old pods are terminated.
    4. A final job runs kong migrations finish.

    Important Considerations:

    • Split Deployments: If you separate proxy and admin nodes into different Helm releases, you must manually set which migration jobs run based on your upgrade order.
    • Hybrid Mode: For hybrid mode, you must upgrade the control plane version first to maintain compatibility.
    • Upgrade Path: The chart automates migrations but does not enforce the recommended Kong upgrade path. If skipping multiple minor versions, consult the official Kong Open Source or Enterprise upgrade guides.
    • Independent Upgrades: It is recommended to upgrade the Helm chart version and the Kong container version independently to isolate issues between Kubernetes resources and Kong itself.
  5. Choose a Kong Runtime Package

    main

    You can switch between different Kong packages by modifying the image.repository and image.tag parameters:

    • Kong Gateway: The Open-Source API Gateway and Ingress solution. This is the default.
    • Kong Enterprise K8S: Builds on the Open-Source Gateway and includes Enterprise-only plugins. When used with Ingress-based configuration, it provides Kong for Kubernetes Enterprise.
    • Kong Enterprise: The full-blown Enterprise package including Manager, Portal, and Vitals. Note: This package cannot be run in DB-less mode.
  6. Understand Kong Operator versioning and breaking changes

    main

    The Kong Operator follows Semantic Versioning (SemVer). Users should not expect breaking changes without a major version change. Any manual actions required by a new version will be documented in the official Kong Operator release notes.

    When running helm install/status/upgrade, the chart will display a warning if your configuration uses deprecated features that have not yet been removed.

  7. Manual IngressClass deletion for version 2.8.0

    main

    In version 2.8.0, the chart-managed IngressClass controller name was updated. Because controller names are immutable, Helm cannot update the existing resource.

    Required Action: You must manually delete the existing IngressClass before upgrading. Helm will recreate it with the correct name during the upgrade.

    kubectl delete ingressclass <class name, "kong" by default>
    helm upgrade RELEASE_NAME kong/kong ...

    Note: Deleting the IngressClass does not affect configuration; the controller will still ingest resources matching the CONTROLLER_INGRESS_CLASS environment variable.

  8. Configure Kong Enterprise Sessions

    main

    Kong Manager and the Developer Portal use the Kong Sessions plugin. Because this requires an HMAC key, configuration must be stored in Kubernetes Secrets.

    1. Create two JSON files: admin_gui_session_conf and portal_session_conf.
    2. Create a single secret containing both files: kubectl create secret generic kong-session-config --from-file=admin_gui_session_conf --from-file=portal_session_conf
    3. In values.yaml, set .enterprise.rbac.session_conf_secret to the name of this secret.
    4. For the Developer Portal, add env.portal_session_conf using a secretKeyRef to the same secret.

    Warning: Always change the secret value in your JSON configuration files before deployment.

    // Example admin_gui_session_conf
    {
      "cookie_name": "admin_session",
      "cookie_samesite": "off",
      "secret": "admin-secret-CHANGEME",
      "cookie_secure": true,
      "storage": "kong"
    }
    kubectl create secret generic kong-session-config --from-file=admin_gui_session_conf --from-file=portal_session_conf