Skip to main content

Overview

Tyk is an open-source API gateway that fronts your APIs with authentication, rate limiting, quotas and analytics. This template deploys the open-source Tyk Gateway as a stateless, autoscaling workload whose API definitions and policies come from Control Plane secrets you control, backed by the bundled Redis template running Redis with Sentinel as the token, rate-limit and quota store. There is no dashboard: APIs are defined as JSON files and keys are managed through the Gateway Control API.
This template deploys into an existing GVC that you already have — it does not create or manage a GVC. Every workload below runs in each location of that GVC.

What Gets Created

The admin API key, your API definitions and your policies are prerequisite secrets you create yourself; the chart references them by name and never creates, modifies or deletes them.

Prerequisites

Three secrets are referenced by name, and each one named in your values must exist before you install. Secrets are org-level, so no --gvc flag is involved.
1

Create the admin API key secret (required)

An opaque secret holding the key for the Gateway Control API under /tyk/, 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 this name. The chart refuses to render without it.
2

Create the API definitions secret

A dictionary secret whose keys are *.json filenames and whose values are Tyk API definitions, mounted at /opt/tyk-gateway/apps. Each definition’s proxy.target_url points at the upstream it fronts — for a workload in the same GVC, use its fully qualified internal address. Because the values are multi-line JSON, write a manifest:
Then apply it:
Set apiSecretName to this name. Setting it to "" omits the mount — but then the gateway serves the demo API baked into the image instead of nothing (see Troubleshooting).
3

Create the policies secret

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 this name, or set it to "" to run with no policies.
4

Choose the Redis and Sentinel passwords

The bundled Redis serves only this gateway, so its passwords are Helm values the chart turns into secrets — nothing to create. They ship as the placeholders change-me-tyk-redis and change-me-tyk-sentinel and are used exactly as written, so set redis.redis.auth.password.value and redis.sentinel.auth.password.value to values of your own.
A missing prerequisite secret wedges the install rather than failing it. apiSecretName and policySecretName default to the names my-tyk-apis and my-tyk-policies, so they must exist too unless you set them to "". cpln helm install reports success and every resource is created, but the gateway container never starts — so cpln logs returns zero lines. The only place the missing secret is named is status.versions[].message:
The message reads The secret <name> no longer exists. Workload updates are paused until the secret is added or the reference to the secret removed. It is get-deployments — plain cpln workload get has no versions key. Create the missing secret and the deployment recovers on its own after several minutes, or run cpln workload force-redeployment RELEASE_NAME-tyk-api-gateway --gvc GVC_NAME to skip the wait.

Installation

Once the secrets exist, install the template into your GVC, naming the secrets and replacing the two password placeholders:
Prefer a values file (-f) over --set for the passwords if you do not want them in your shell history.

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

Image and Port

The chart refuses to render if listenPort is one of the container ports Control Plane reserves.

API Definitions and Policies

Definitions and policies are read when the gateway starts. To change them, see Updating API Definitions and Policies.

Master Keys

With the default false, every key created through /tyk/keys must carry an access_rights entry naming the APIs it may reach. Requests that omit it are refused — see Troubleshooting for the exact responses.

Resources and Autoscaling

Access

The chart refuses to render with externalAccess: false and internalAccess.type: none together, since nothing could reach the gateway. An access change takes up to a few minutes to take effect after an upgrade.
externalAccess: true puts the Tyk admin API on the public internet. The Gateway Control API under /tyk/ is served on the same port as your proxied APIs and cannot be split onto another listener, so publishing the gateway publishes key management with it and the admin secret becomes the only thing in front of it.

Redis and Sentinel

Replace both change-me-… passwords before installing. Keys under redis are passed to the bundled Redis template; see its page for the full set.

Outbound Connectivity

The gateway’s outbound firewall is closed and there is no value to open it. Every API’s target_url must point at an upstream in the same GVC, addressed by its fully qualified internal name — for example http://WORKLOAD_NAME.GVC_NAME.cpln.local:8080, where the port is the upstream workload’s container port. The upstream workload’s own internal firewall must admit the gateway. Proxying to an API on the public internet requires adding outboundAllowCIDR or outboundAllowHostname to the gateway workload yourself.

Connecting

Read the admin key from its secret when you need it (it appears as payload):
To check the gateway without opening it to the internet, forward its port to your machine:
Then, in a second terminal, call the health check and list the loaded APIs, passing the admin key in the header:
A healthy gateway reports redis as pass in the /hello response, and /tyk/apis lists the definitions from your API secret.

Operations

Backing Up

The API definitions and policies live only in your own secrets, so keep their manifests in version control. Keys issued through the Gateway Control API, plus rate-limit and quota counters, live in the bundled Redis, whose volume sets take a daily snapshot kept for 7 days. Uninstalling the release deletes those volume sets.

Restoring a Backup

Restoring the bundled Redis from a volume-set snapshot has not been verified for this template. If you depend on keys issued through the Gateway Control API, keep a record of them outside the gateway so you can reissue them.

Updating API Definitions and Policies

Re-apply the edited manifest, then force a redeployment — a running gateway does not pick up a changed secret on its own:
Keep the secret names unchanged; the release references them by name.

Upgrading from 1.2.1 or Earlier

Version 1.3.0 is a security fix. Versions up to 1.2.1 shipped the Gateway Control API key as the values.yaml value mysecret, published the gateway to the internet by default, and hardcoded master keys on — so one guessed word yielded a key to every API.
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 reach the gateway. Set each one explicitly if you want the old behavior. An in-place upgrade from 1.2.1 has not been verified end to end, so try it on a non-production release first.
1

Create the admin key secret

Use a freshly generated value — mysecret was published in a public repository, so treat any key minted under it as compromised and plan to reissue it:
Set adminSecretName to that name and drop adminSecret from your values; it no longer exists in the chart. Every client calling /tyk/ needs the new value.
2

Decide whether the gateway stays public

If clients outside Control Plane call your APIs, set externalAccess: true explicitly, knowing it also publishes /tyk/. If every caller is inside the GVC, the default same-gvc covers them.
3

Audit keys created without access rights

Under the old hardcoded setting such keys reach every API. List keys with GET /tyk/keys and reissue each with an access_rights entry naming only the APIs it needs.
4

Set the Redis and Sentinel passwords

Set redis.redis.auth.password.value and redis.sentinel.auth.password.value to values of your own; the placeholders are used verbatim otherwise.
5

Run the upgrade

Carry over the rest of your values (API and policy secret names, passwords, access settings) with -f values.yaml or further --set flags.

Scaling and Availability

The gateway is stateless and autoscales between autoscaling.minScale and autoscaling.maxScale replicas on CPU; raise minScale to 2 or more to keep a replica serving while another restarts. Redis runs 2 replicas behind 3 Sentinels, which promote a new Redis primary if the current one fails. Set multiZone: true to spread gateway replicas across availability zones where the location supports it.

Troubleshooting

Symptom: cpln helm install succeeded, but RELEASE_NAME-tyk-api-gateway has no running containers and cpln logs returns nothing.Cause: A secret named in adminSecretName, apiSecretName or policySecretName does not exist. The defaults my-tyk-apis and my-tyk-policies count — they must exist unless set to "".Fix: Read the message naming the secret, then create it:
Once the secret exists the deployment recovers on its own, or run cpln workload force-redeployment RELEASE_NAME-tyk-api-gateway --gvc GVC_NAME to skip the wait.
Symptom: The install looks healthy, but /tyk/apis lists Tyk Test API and none of your definitions.Cause: apiSecretName is "", so no definitions are mounted and the gateway falls back to the demo API baked into the upstream image.Fix: Create the API definitions secret, set apiSecretName to its name with cpln helm upgrade, and confirm with GET /tyk/apis.
Symptom: A key-creation request that sends "access_rights": {} is refused:Cause: allowMasterKeys is false, so a key with no access rights is rejected. The gateway log names the reason: Master keys disallowed in configuration, key not added.Fix: Give the key an access_rights entry naming the APIs it may reach. Setting allowMasterKeys: true restores blanket keys and the exposure that comes with them. To see the log line:
Symptom: Requests to an API whose target_url is outside Control Plane fail, while APIs pointing at workloads in the GVC work.Cause: The gateway’s outbound firewall is closed.Fix: Point target_url at an in-GVC upstream using its fully qualified .GVC_NAME.cpln.local name, or add outboundAllowCIDR or outboundAllowHostname to the gateway workload yourself.
Symptom: A call from another workload to the internal gateway address does not succeed.Cause: The gateway’s internal firewall does not admit the caller. Only callers allowed by internalAccess.type can reach it.Fix: Widen internalAccess.type, or add the caller to internalAccess.workloads with type: workload-list, then allow a few minutes for the change to take effect.
Symptom: You re-applied the API or policy secret, but the gateway still serves the old configuration.Cause: Definitions and policies are read when the gateway starts, and a running replica does not pick up a changed secret.Fix: Force a redeployment, as in Updating API Definitions and Policies.
Symptom: A newly started replica reports ready, but /hello does not yet report redis as pass and the log shows storage: Redis is either down or was not configured.Cause: The gateway declares no health probes, so ready means the container started, not that it has connected to Redis.Fix: Wait and re-check GET /hello. Expect the same short gap whenever an autoscaled replica starts.

Important Notes

  • Create the prerequisite secrets before installing, including apiSecretName and policySecretName unless you set them to "".
  • Leave externalAccess off unless you need it — enabling it also publishes the Gateway Control API under /tyk/.
  • Leave allowMasterKeys off — with it on, any key created without access_rights reaches every API on the gateway.
  • Change the Redis and Sentinel passwords — they ship as change-me-… placeholders and are used exactly as written.
  • Force a redeployment after changing a prerequisite secret, including after rotating the admin key — the running gateway keeps the old value until it restarts.
  • Your prerequisite secrets survive cpln helm uninstall — delete them yourself 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