Managing secrets in Kong Mesh

Uses: Kong Mesh
Related Documentation
Related Resources

The Secret resource enables users to store sensitive data. This includes anything a user considers non-public, such as:

  • TLS keys
  • Tokens
  • Passwords

Secrets belong to a specific Mesh resource, and can’t be shared across different Meshes. Policies use secrets at runtime.

Kong Mesh leverages Secret resources internally for certain operations, for example when storing auto-generated certificates and keys when Mutual TLS is enabled.

Store secrets

How you store secrets in the Secrets resource depends on if you’re using Kubernetes or Universal for your environment.

The data field of a Kong Mesh secret is a Base64-encoded value. Use the base64 command in Linux or macOS to encode any value in Base64:

# Base64 encode a file
cat cert.pem | base64

# or Base64 encode a string
echo "value" | base64

Secret scopes

Kong Mesh provides two types of secrets:

Mesh-scoped secrets

Mesh-scoped secrets are bound to a given mesh. This is the only type of secret that can be used in mesh policies like the Provided CA or TLS setting in External Service.

Global secrets

Global secrets are not bound to a given mesh and can’t be used in mesh policies. Global secrets are used for internal purposes, to store zone tokens or user token signing keys for example.

Secrets in multi-zone deployments

Secrets are synced from the global control plane to the zones CPs, but not the other way around as this would risk exposing sensitive information.

v2.10+ If there’s a name conflict between a secret on the global CP and a secret on a zone CP, the secret is not overwritten and a warning will appear in the logs. In versions prior to 2.10, secrets can’t be created on a zone control plane.

Using secrets

Here is an example of how to use a Kong Mesh Secret with a provided Mutual TLS backend.

The examples below assume that the Secret object has already been created:

FAQs

No, there are no integrations to reference secrets.

Help us make these docs great!

Kong Developer docs are open source. If you find these useful and want to make them better, contribute today!