Skip to main content

Overview

Tyk is an open-source API management platform that controls, secures, and monitors API traffic. This template deploys a Tyk Gateway workload on Control Plane alongside Redis and Redis Sentinel, which back the gateway’s token, rate-limit, quota, and analytics storage. Your API definitions and policies come from Control Plane secrets you control, and the Gateway Control API key — the credential that creates and revokes every API key on the gateway — comes from an opaque secret you create before installing.
Version 1.3.0 is a security fix. Read Upgrading From 1.2.1 or Earlier before you upgrade. Versions up to 1.2.1 shipped three defaults that compounded: the Gateway Control API key was the values.yaml value mysecret, externalAccess defaulted to true so that API was on the public internet, and TYK_GW_ALLOWMASTERKEYS was hardcoded to true so a key created with no access_rights reached every API on the gateway. One guessed word yielded a key to everything. In 1.3.0 the admin key moved to a prerequisite secret, external access defaults to off, master keys are a knob that defaults to off, and internalAccess.type now defaults to same-gvc instead of nonethose last three change the behavior of an existing install when you upgrade, and the internal-access change widens in-GVC reachability rather than narrowing it.
This template does not create a GVC. You must deploy it into an existing GVC.

What Gets Created

  • Standard Tyk Gateway Workload (RELEASE_NAME-tyk-api-gateway) — the gateway process, autoscaling between minScale and maxScale replicas on CPU. API definitions and policies are mounted from your secrets at startup.
  • Redis and Redis Sentinel — the Redis template (v3.4.2) is deployed as a subchart, creating a Redis workload, a Sentinel workload, their volume sets, their config and password secrets, and an identity and policy for each (RELEASE_NAME-redis-identity, RELEASE_NAME-sentinel-identity, RELEASE_NAME-redis-policy, RELEASE_NAME-sentinel-policy). The gateway connects through Sentinel, not to Redis directly.
  • Identity & Policy — an identity (RELEASE_NAME-tyk-identity) bound to the gateway with reveal on exactly the secrets it mounts: your admin secret, your API and policy secrets when set, and the bundled Redis and Sentinel password secrets.
  • No template-created credential secret — the admin API key lives only in the prerequisite secret you create.

Prerequisites

The admin secret must exist before you install, and you will normally want the API and policy secrets too. All are referenced by name only, so none of their contents pass through Helm values or land in the release.

1. Admin API Key (Required)

This is TYK_GW_SECRET, the key for the Gateway Control API served under /tyk/* and sent as the X-Tyk-Authorization header. Whoever holds it can create, list, and revoke every API key on the gateway, so generate a strong random value:
Set adminSecretName to the name you used. The chart refuses to render without it.

2. API Definitions (Optional)

A dictionary secret whose keys are *.json filenames and whose values are Tyk API definitions, mounted at /opt/tyk-gateway/apps. Because the values are multi-line JSON, write a manifest and apply it:
Set apiSecretName to the name you used.
Leaving apiSecretName empty does not serve nothing — it serves Tyk’s demo API. With no definitions mounted, the gateway falls back to the API definitions baked into the upstream image and boots serving Tyk Test API. The install looks entirely healthy — the workload is ready and /hello reports redis: pass — while serving none of your APIs. Set the secret, or expect the vendor demo endpoint on your listener.

3. Policies (Optional)

An opaque secret with encoding plain, holding a single JSON object of policies keyed by policy ID, mounted at /opt/tyk-gateway/policies/policies.json:
Set policySecretName to the name you used, or leave it "" to run with no policies. You can edit both secrets independently after install, as long as their names stay the same.
A missing prerequisite secret wedges the install rather than failing it. cpln helm install still exits 0 and reports success, every resource is created, and the gateway then never becomes ready — with no container logs at all, because the container never started. The only place the reason appears is cpln workload get-deployments RELEASE_NAME-tyk-api-gateway --gvc GVC_NAME, as The secret <name> no longer exists. Workload updates are paused until the secret is added or the reference to the secret removed. Create the secrets first and check the deployment rather than trusting the Helm output.

Installation

To install, follow the instructions for your preferred method:

UI

Browse, install, and manage templates visually

CLI

Manage templates from your terminal

Terraform

Declare templates in your Terraform configurations

Pulumi

Declare templates in your Pulumi programs

Configuration

The default values.yaml for this template:

API Definitions and Policies

  • apiSecretName — name of the dictionary secret holding your API definitions. Each key is a JSON filename mounted at /opt/tyk-gateway/apps. Set to "" to omit the mount — but see the demo-API warning in Prerequisites.
  • policySecretName — name of the opaque secret holding your policies JSON, mounted at /opt/tyk-gateway/policies/policies.json. Set to "" to run with no policies.
  • listenPort — the port the gateway listens on. Control Plane reserves a set of container ports; the chart refuses to render on one of them rather than letting the workload be rejected at apply time.
Both secrets are read at boot. After editing either one, redeploy the gateway workload or call /tyk/reload for the change to take effect.

Master Keys

  • allowMasterKeys — when true, a key created through /tyk/keys with no access_rights section can call every API on this gateway. Defaults to false, matching upstream Tyk.
This default changed in 1.3.0 and it will break key-creation requests that used to work. Versions up to 1.2.1 hardcoded master keys on, so any request that POSTed a bare session object was silently granted blanket access. With allowMasterKeys: false, the same request is refused — the exact response depends on the endpoint:In both cases the gateway logs the real reason: Master keys disallowed in configuration, key not added. with err="master keys disabled". The fix is to give each key an access_rights entry naming the APIs it may reach; setting allowMasterKeys: true restores the old behavior and the old exposure.

Access

  • externalAccess — when true, the gateway’s external inbound firewall opens to 0.0.0.0/0 and Control Plane assigns a *.cpln.app canonical endpoint. Defaults to false.
  • internalAccess.type — which workloads inside Control Plane may reach the gateway. Defaults to same-gvc.
  • internalAccess.workloads — list of workload links, used only when type is workload-list.
externalAccess: true puts the Tyk admin API on the public internet. /tyk/* is served on the same port as your proxied APIs and cannot be split onto another listener, so publishing the gateway publishes its key-management API with it and the admin secret becomes the only thing in front of it. Prefer leaving it false and reaching the gateway from inside the GVC.
Setting externalAccess: false together with internalAccess.type: none would leave nothing able to reach the gateway, so the chart fails the render with a message naming both knobs instead of installing something unreachable.An access change takes up to a couple of minutes to take effect. Enabling external access was measured at 30 seconds from upgrade to the first 200, and closing internal access at about 32 seconds; re-poll before concluding a knob did nothing. Note that a request blocked by the internal firewall times out rather than returning 403 — a hang is what a correctly closed internal firewall looks like here, not a sign that the gateway is down.

Resources and Autoscaling

  • resources.cpu / resources.memory — CPU and memory allocated to the gateway workload.
  • autoscaling.minScale / autoscaling.maxScale — minimum and maximum number of gateway replicas.
  • autoscaling.metric — scaling metric (cpu by default).
  • autoscaling.target — target metric value that triggers a scale-up.
  • autoscaling.scaleToZeroDelay — seconds of inactivity before scaling to zero (only applies when minScale is 0).
  • multiZone — when true, spreads replicas across availability zones within the location.

Redis and Sentinel

The bundled Redis is configured under the redis key; see the Redis template for full configuration details.
  • redis.redis.replicas — number of Redis replicas.
  • redis.sentinel.replicas — number of Sentinel replicas; 3 is the default and the recommended minimum for failover.
  • redis.redis.persistence.enabled / redis.sentinel.persistence.enabled — persist data and Sentinel state to volume sets.
  • redis.redis.auth.password.value / redis.sentinel.auth.password.value — the Redis and Sentinel passwords.
This Redis serves only this gateway and is never reachable from outside the GVC, so its passwords remain Helm values rather than prerequisite secrets. They are used exactly as written, so replace both change-me-… placeholders before installing.

Outbound Connectivity

The gateway ships with an empty outbound firewall (outboundAllowCIDR: []), so it cannot open connections to the public internet.
Every API’s target_url must point at an upstream inside the same GVC, addressed over internal DNS — for example http://my-app.GVC_NAME.cpln.local:8080. GVC-internal traffic is governed by the destination workload’s internal firewall rather than by the gateway’s egress, so in-GVC proxying works normally with egress closed. To proxy to an API on the public internet, add outboundAllowCIDR or outboundAllowHostname to the gateway workload; there is no value for it in the chart.

Connecting

Reveal the admin key when you need it:

Ports

Upgrading From 1.2.1 or Earlier

Three defaults change behavior on upgrade: the gateway stops being reachable from the internet, key-creation requests without access_rights start failing, and the internal firewall opens from none to same-gvc so every workload in the GVC can now reach the gateway. None is a fault; all three will surprise you if you have not planned for them — set internalAccess.type explicitly if you want the old, closed behavior.
What to do before upgrading:
1

Create the admin key secret

The gateway will not start without it. Use a freshly generated value rather than carrying mysecret forward — it has been published in a public repository for the life of the earlier versions, and any key minted with it should be considered compromised:
Set adminSecretName to that name and remove adminSecret from your values — it no longer exists in the chart. Every client calling /tyk/* needs the new value in its X-Tyk-Authorization header.
2

Decide whether the gateway should stay public

If clients outside Control Plane call your APIs, set externalAccess: true explicitly — and understand that this also republishes /tyk/*. If every caller is inside the GVC, do nothing and the default same-gvc covers them.
3

Audit any key created without access rights

Under the old hardcoded setting, such keys reach every API on the gateway. List them with GET /tyk/keys, then reissue each one with an access_rights entry naming only the APIs it needs. Requests that create bare keys now fail — see Master Keys for the exact responses.
4

Set the Redis and Sentinel passwords

The placeholder defaults are used verbatim if you leave them, so set both redis.redis.auth.password.value and redis.sentinel.auth.password.value to values of your own.

Important Notes

  • Create the admin secret before installing. A missing secret does not fail the install — Helm reports success and the gateway then sits at zero replicas with no container logs at all.
  • externalAccess: true publishes the admin API, because /tyk/* shares the listener with your proxied APIs. The admin secret is then the only control in front of key creation and revocation.
  • allowMasterKeys: true grants blanket access. Any key created without access_rights reaches every API on the gateway. Leave it false unless you have a specific reason.
  • Leaving apiSecretName empty serves Tyk’s demo API, not an empty gateway. The install looks healthy while none of your APIs are loaded.
  • Egress is closed, so every target_url must resolve to an in-GVC *.cpln.local host.
  • Change the bundled Redis and Sentinel passwords — they ship as change-me-… placeholders and are used exactly as written.
  • The gateway declares no health probes, so ready: true arrives before it can serve. A workload was ready roughly 30 seconds before it had connected to Redis, logging storage: Redis is either down or was not configured in between. Use GET /hello and check that redis reports pass rather than trusting the readiness signal, and expect the same gap when an autoscaled replica starts.
  • Access changes take up to a couple of minutes to propagate. A change that appears to do nothing has usually just not settled yet.
  • The first helm upgrade after an install restarts the bundled Redis, briefly interrupting rate-limit and key lookups even when nothing changed. Later no-op upgrades do not.
  • The prerequisite secrets are not owned by the release — your admin, API, and policy secrets survive cpln helm uninstall and must be deleted manually if you no longer need them.

External References

Tyk Gateway Documentation

Official Tyk API Gateway documentation

Gateway Configuration Options

Every gateway setting and its environment-variable name

Gateway Control API

Reference for the admin endpoints under /tyk/

API Definition Objects

Reference for the API definition JSON structure

Security Policies

Guide for configuring Tyk access policies

Tyk Template

View the source files, default values, and chart definition