Skip to content
Kong Logo | Kong Docs Logo
search
  • We're Hiring!
  • Docs
    • Kong Gateway
    • Kong Konnect
    • Kong Mesh
    • Plugin Hub
    • decK
    • Kong Ingress Controller
    • Insomnia
    • Kuma

    • Docs contribution guidelines
  • Plugin Hub
  • Support
  • Community
  • Kong Academy
Get a Demo Start Free Trial
  • Kong Gateway
  • Kong Konnect
  • Kong Mesh
  • Plugin Hub
  • decK
  • Kong Ingress Controller
  • Insomnia
  • Kuma

  • Docs contribution guidelines
  • 3.3.x (latest)
  • 3.2.x
  • 3.1.x
  • 3.0.x
  • 2.8.x
  • 2.7.x
  • 2.6.x
  • Older Enterprise versions (2.1-2.5)
  • Older OSS versions (2.1-2.5)
  • Archive (pre-2.1)

github-edit-pageEdit this page

report-issueReport an issue

enterprise-switcher-iconSwitch to OSS

On this pageOn this page
  • Query arguments
  • Environment variables
  • Vaults entity
  • Vaults CLI
  • Declarative configuration
  • Shared configuration parameters
Kong Gateway
3.0.x
  • Home
  • Kong Gateway
  • Kong Enterprise
  • Secrets Management
  • Advanced Secrets Configuration
You are browsing documentation for an outdated version. See the latest documentation here.

Advanced Secrets Configuration

Vault implementations offer a variety of advanced configuration options. For specific configuration parameters for your vault backend, see the backend reference.

Kong Manager currently doesn’t support configuring vault entities.

Query arguments

You can configure your vault backend with query arguments.

For example, the following query uses an option called prefix with the value SECURE_:

{vault://env/my-secret-config-value?prefix=SECURE_}

For more information on available configuration options, refer to respective vault backend documentation.

Environment variables

You can configure your vault backend with KONG_VAULT_<vault-backend>_<config_opt> environment variables.

For example, Kong Gateway might look for an environment variable that matches KONG_VAULT_ENV_PREFIX:

export KONG_VAULT_ENV_PREFIX=SECURE_

Vaults entity

You can configure your vault backend using the vaults entity.

The Vault entity can only be used once the database is initialized. Secrets for values that are used before the database is initialized can’t make use of the Vaults entity.

Create a Vault entity:

curl -i -X PUT http://HOSTNAME:8001/vaults/my-env-vault-1  \
  --data name=env \
  --data description='ENV vault for secrets' \
  --data config.prefix=SECRET_

Result:

{
    "config": {
        "prefix": "SECRET_"
    },
    "created_at": 1644929952,
    "description": "ENV vault for secrets",
    "id": "684ff5ea-7f65-4377-913b-880857f39251",
    "name": "env",
    "prefix": "my-env-vault-1",
    "tags": null,
    "updated_at": 1644929952
}

Config options depend on the associated backend used.

This lets you drop the configuration from environment variables and query arguments and use the entity name in the reference:

{vault://my-env-vault/my-secret-config-value}

Vaults CLI

Usage: kong vault COMMAND [OPTIONS]

Vault utilities for Kong Gateway.

Example usage:
 TEST=hello kong vault get env/test

The available commands are:
  get <reference>  Retrieves a value for <reference>

Options:
 -c,--conf    (optional string)  configuration file
 -p,--prefix  (optional string)  override prefix directory
 --v              verbose
 --vv             debug

Declarative configuration

Secrets management is supported in decK 1.16 and later.

You can configure a vault backend with decK. For example:

vaults:
- config:
    prefix: MY_SECRET_
  description: ENV vault for secrets
  name: env
  prefix: my-env-vault

For more information on configuring vaults and using secret references in declarative configuration files, see Secret Management with decK.

Shared configuration parameters

Every vault supports the following configuration parameters:

Parameter UI field name Description
vaults.description optional Description An optional description for your vault.
vaults.name N/A The type of vault. Accepts one of: env, gcp, aws, or hcv.
vaults.prefix Prefix The reference prefix. You need this prefix to access secrets stored in this vault. For example, {vault://my-env-vault/<some-secret>}.
Thank you for your feedback.
Was this page useful?
  • Kong
    THE CLOUD CONNECTIVITY COMPANY

    Kong powers reliable digital connections across APIs, hybrid and multi-cloud environments.

    • Company
    • Customers
    • Events
    • Investors
    • Careers Hiring!
    • Partners
    • Press
    • Contact
  • Products
    • Kong Konnect
    • Kong Gateway
    • Kong Mesh
    • Get Started
    • Pricing
  • Resources
    • eBooks
    • Webinars
    • Briefs
    • Blog
    • API Gateway
    • Microservices
  • Open Source
    • Install Kong Gateway
    • Kong Community
    • Kubernetes Ingress
    • Kuma
    • Insomnia
  • Solutions
    • Decentralize
    • Secure & Govern
    • Create a Dev Platform
    • API Gateway
    • Kubernetes
    • Service Mesh
Star
  • Terms•Privacy
© Kong Inc. 2023