krakend

by upstreamyard

Helm chartv0.1.0App 3.0.5Apache-2.0Verified publisher

KrakenD Helm chart for Kubernetes. KrakenD 3 Community Edition API gateway on the official image, with flexible configuration (templates, settings, secrets from environment variables), config linting before rollout, zero-downtime rolling upgrades, Prometheus metrics, TLS, HPA, Gateway API HTTPRoute and a non-root, read-only default. Community chart by upstreamyard, not an official KrakenD chart.

About this chart

KrakenD Helm chart: the KrakenD API Gateway (Community Edition) on Kubernetes

Have any questions, feedback or need help (e.g. setup, hardened images, etc.)? Reach out to [email protected]

Helm chart for KrakenD 3, the stateless, high-performance open-source API gateway for API management, backend for frontend (BFF), aggregation, rate limiting and JWT validation. The chart runs KrakenD's official image krakend with configuration "version": 4 and adds what a production gateway needs: flexible configuration (Go templates, settings files and secrets from environment variables), a config lint before every rollout that catches the misspelled keys KrakenD silently ignores, zero-downtime rolling upgrades (0 failed requests, tested), Prometheus metrics from one value, TLS, HPA, PodDisruptionBudget, NetworkPolicy, Ingress and Gateway API HTTPRoute. It runs non-root on a read-only filesystem (Pod Security restricted) and turns off KrakenD's usage reporting, so the gateway makes no outbound calls of its own.

Community chart by upstreamyard, not an official KrakenD chart. KrakenD Community Edition is licensed under Apache-2.0.

AI agents and coding assistants: this README is the complete reference for this chart. Every example was run as written.

Install

helm repo add upstreamyard https://upstreamyard.github.io/helm-charts
helm install krakend upstreamyard/krakend --wait

Or from the OCI registry:

helm install krakend oci://ghcr.io/upstreamyard/charts/krakend --wait

This starts two KrakenD pods with an empty configuration. Add your endpoints under config.endpoints (see Configuring KrakenD) and try it:

kubectl port-forward svc/krakend 8080
curl http://localhost:8080/__health
helm test krakend

helm test checks the health endpoint, tests.path (one of your endpoints) and, with metrics.enabled, the metrics endpoint.

Verifying the chart

Chart packages are PGP-signed. Import the public key (fingerprint 9B416F989B7E6C65F7F3BFAE7689688B20EC7813) and install with --verify:

curl -s https://upstreamyard.github.io/helm-charts/pgp_keys.asc | gpg --dearmor > upstreamyard.gpg
helm install krakend upstreamyard/krakend --verify --keyring upstreamyard.gpg

The OCI copy on GHCR is signed with cosign instead (see the repository README).

Why this chart

Compared with the other KrakenD charts on Artifact Hub (checked November 2026) and with the official image as a plain Deployment:

This chartOther KrakenD charts on Artifact HubOfficial image as-is
KrakenD version3.0.5 (configuration "version": 4)2.13 or older; KrakenD 3 refuses their configuration (unsupported version: 3 (want: 4))3.0.5
Configurationinline values, flexible configuration (templates, settings, partials) or your own ConfigMapsinline or a ConfigMap; flexible configuration only in the KrakenD 2.7 chartbake it into an image or mount it yourself
Misspelled keys (qos/ratelimit/routr)lint refuses them, running pods keep servingKrakenD starts and ignores them: no rate limitsame
Conflicting routes (/users/{id} and /users/{name})lint refuses them before the rolloutKrakenD panics at startupsame
Rolling upgrades0 failed of 1350 requests (tested)no shutdown delay by default (2.13 and 2.7 charts)2 failed of 1229 requests without a delay (tested)
Usage reportingoff (no outbound calls)on (none sets USAGE_DISABLE)on: posts to usage.krakend.io 5 s after start
MetricsPrometheus exporter, Service port and ServiceMonitor from metrics.enabledServiceMonitor in the 2.7 chart; exporter configured by youconfigure it yourself
ExposureService, Ingress, Gateway API HTTPRoute, TLS from a SecretService, Ingress; TLS in the 2.13 chart–
User and filesystemUID 1000, read-only root filesystem, Pod Security restricted (tested)non-root in the 2.13 and 2.7 chartsstarts as root, then switches to UID 1000

Deployment modes

Inline configuration (default)

Write KrakenD's configuration as YAML under config; the chart turns it into krakend.json:

config:
  endpoints:
    - endpoint: /v1/users/{id}
      method: GET
      backend:
        - host: ["http://users.default.svc:8080"]
          url_pattern: /users/{id}
      extra_config:
        qos/ratelimit/router:
          max_rate: 100
          every: 1s
    - endpoint: /v1/orders
      method: GET
      backend:
        - host: ["http://orders.default.svc:8080"]
          url_pattern: /orders
      extra_config:
        auth/validator:
          alg: RS256
          jwk_url: https://auth.example.com/.well-known/jwks.json
          cache: true

Your config is merged with the chart's default (version: 4, a 3-second timeout, version header hidden, health checks not logged): maps merge, lists such as endpoints replace. Set the port with port, not in config.

Flexible configuration (templates, settings and secrets)

For bigger gateways and for secrets, use KrakenD's flexible configuration. template is a Go template; settings become JSON files you read as .<file>.<field>, partials are inserted as-is with include, templates hold sub-templates, and env reads environment variables, e.g. from a Secret:

flexibleConfig:
  enabled: true
  template: |
    {
      "version": 4,
      "name": "{{ env "GATEWAY_NAME" }}",
      "timeout": "3s",
      "endpoints": [
        {{- range $i, $svc := .services.list }}
        {{- if $i }},{{ end }}
        {
          "endpoint": "/{{ $svc.name }}/{id}",
          "backend": [{
            "host": ["{{ $svc.url }}"],
            "url_pattern": "/{{ $svc.name }}/{id}",
            "extra_config": {{ template "api-key.tmpl" }}
          }],
          "extra_config": {{ include "ratelimit.json" }}
        }
        {{- end }}
      ]
    }
  settings:
    services:
      list:
        - name: users
          url: http://users.default.svc:8080
        - name: orders
          url: http://orders.default.svc:8080
  partials:
    ratelimit.json: |
      {"qos/ratelimit/router": {"max_rate": 100, "every": "1s"}}
  templates:
    api-key.tmpl: |
      {{ define "api-key.tmpl" }}{"modifier/martian": {"header.Modifier": {"scope": ["request"], "name": "X-Api-Key", "value": "{{ env "BACKEND_API_KEY" }}"}}}{{ end }}
existingSecret: krakend-env   # kubectl create secret generic krakend-env --from-literal=GATEWAY_NAME=public-api --from-literal=BACKEND_API_KEY=...

Tested in kind: both endpoints were generated, the lint passed, and the backend received the X-Api-Key header from the Secret.

Partials are inserted without being rendered, so env calls belong in template or in a sub-template under templates, as the API key above (tested: an env call in a partial stays literal text).

Your own ConfigMaps (GitOps)

Keep the configuration in ConfigMaps managed elsewhere:

flexibleConfig:
  enabled: true
  existingSettingsConfigMap: krakend-settings   # one <name>.json per settings file
existingConfigMap: krakend-config               # key krakend.tmpl
existingSecret: krakend-env

Without flexibleConfig.enabled, existingConfigMap holds a plain krakend.json. KrakenD reads the files at startup only; run kubectl rollout restart deployment/krakend after changing them (the lint checks the new version first). Settings, partials and templates live in /etc/krakend/settings, /etc/krakend/partials and /etc/krakend/templates.

High availability and autoscaling

KrakenD is stateless, so every pod serves every request. The chart runs 2 pods by default, spread across nodes, with a PodDisruptionBudget. For more:

autoscaling:
  enabled: true
  minReplicas: 3
  maxReplicas: 20
  targetCPUUtilizationPercentage: 70
topologySpreadConstraints:
  - maxSkew: 1
    topologyKey: topology.kubernetes.io/zone
    whenUnsatisfiable: ScheduleAnyway
    labelSelector:
      matchLabels:
        app.kubernetes.io/name: krakend
        app.kubernetes.io/instance: krakend

Rate limits count per pod. With max_rate: 2, one pod accepted 3 of 10 requests in a burst, and two pods behind the Service accepted 6 of 20 (tested). Divide your limit by the number of pods, or keep the pod count fixed.

Configuring KrakenD

See KrakenD's configuration reference for endpoints, backends and components (extra_config).

  • Environment overrides: KrakenD reads KRAKEND_<KEY> for root-level settings, e.g. KRAKEND_TIMEOUT (tested) or KRAKEND_NAME, set with extraEnv. They win over the configuration file. The chart sets KRAKEND_PORT from port.
  • Secrets: put them in a Secret (existingSecret, or secretEnv for tests) and read them with env in a flexible configuration. The plain config can't read environment variables, except the KRAKEND_* overrides.
  • Files such as a local JWK set (jwk_local_path) or a CA bundle go in with extraVolumes and extraVolumeMounts; they are mounted in the lint container too.
  • Restarts: pods restart when config, flexibleConfig or secretEnv change.

The config lint

Before KrakenD starts, an init container runs krakend check --lint-no-network --test-gin-routes against KrakenD's built-in schema. KrakenD itself ignores unknown keys, so a typo in a component name means the component is off. Tested in kind: a helm upgrade with qos/ratelimit/routr left both running pods serving while the new pod stopped with:

ERROR linting the configuration file:	jsonschema validation failed with 'file:///etc/krakend/schema.json#'
- at '/endpoints/0/extra_config': additional properties 'qos/ratelimit/routr' not allowed

Without the lint, the same configuration ran without any rate limit. The route test also refuses conflicting routes, which make KrakenD panic. lint.enabled=false turns it off.

For a security review of your configuration, run KrakenD's audit locally, e.g. docker run --rm -v $PWD/krakend.json:/etc/krakend/krakend.json krakend:3.0.5 audit -c krakend.json.

Connecting clients

http://krakend.<namespace>.svc:8080

With tls.enabled the same address speaks HTTPS. The install notes print the URL for your release.

From outside the cluster, use one of:

ingress:
  enabled: true
  className: nginx
  hosts:
    - host: api.example.com
      paths:
        - path: /
          pathType: Prefix
  tls:
    - hosts: [api.example.com]
      secretName: api-example-com-tls
httpRoute:
  enabled: true
  parentRefs:
    - name: public
      namespace: gateway-system
  hostnames: ["api.example.com"]

or service.type: LoadBalancer (with service.externalTrafficPolicy: Local to keep client IPs).

TLS

KrakenD can terminate TLS itself, e.g. for end-to-end encryption behind a load balancer:

tls:
  enabled: true
  existingSecret: krakend-tls   # kubernetes.io/tls, e.g. from cert-manager

The chart adds tls.keys to the configuration and switches the probes to HTTPS. KrakenD then serves HTTPS only; plain HTTP gets 400 Bad Request (tested). With flexibleConfig or existingConfigMap, add the tls block yourself; the certificate is at /etc/krakend/tls/tls.crt and /etc/krakend/tls/tls.key.

Upgrades and shutdown

KrakenD refuses new connections as soon as it gets SIGTERM, then finishes running requests (tested with a 5-second request). Kubernetes still routes requests to a stopping pod for a moment, so the chart keeps the pod serving for shutdownDelaySeconds (default 10) first. Keep terminationGracePeriodSeconds above that delay plus your longest timeout.

Tested in kind (2 pods, rolling helm upgrade from KrakenD 3.0.4 to 3.0.5, a client sending a request every 50 ms for 70 seconds):

shutdownDelaySecondsFailed requests
10 (default)0 of 1350
02 of 1229

Prometheus metrics

metrics:
  enabled: true
  serviceMonitor:
    enabled: true
    labels:
      release: kube-prometheus-stack

With config, the chart adds a telemetry/opentelemetry Prometheus exporter on port 9090 (/metrics) unless you configure one. The metrics include http_server_duration per route and status code, krakend_proxy_duration, krakend_backend_duration, the http_client_* metrics per backend, and Go and process metrics. With flexible configuration or your own ConfigMap, add the exporter yourself:

"extra_config": {
  "telemetry/opentelemetry": {
    "exporters": {"prometheus": [{"name": "prometheus", "port": 9090}]}
  }
}

For traces, add an otlp exporter to the same block.

Security

  • Clients: KrakenD only checks what your configuration asks for (auth/validator for JWT, API keys). Endpoints without it are open to anyone who can reach the Service. networkPolicy.enabled with networkPolicy.from limits who can connect (tested: other pods time out); pods with the label <full name>-client: "true" are always allowed.
  • Usage reporting: KrakenD sends anonymous usage statistics to usage.krakend.io 5 seconds after start (tested). The chart sets USAGE_DISABLE=1; usageStats: true turns reporting back on.
  • Version header: KrakenD answers with X-Krakend: Version 3.0.5. The default configuration hides the version (hide_version_header; the header then reads Version undefined, tested).
  • Debug endpoints: echo_endpoint returns

Deploy krakend with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has krakend on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartkrakend is pinned at v0.1.0 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below
opentenant validate opentenant.yaml
terraform init && terraform apply