Skip to content
Kong Logo | Kong Docs Logo
search
  • Docs
    • Explore the API Specs
      View all API Specs View all API Specs View all API Specs arrow image
    • Documentation
      API Specs
      Kong Gateway
      Lightweight, fast, and flexible cloud-native API gateway
      Kong Konnect
      Single platform for SaaS end-to-end connectivity
      Kong Mesh
      Enterprise service mesh based on Kuma and Envoy
      decK
      Helps manage Kong’s configuration in a declarative fashion
      Kong Ingress Controller
      Works inside a Kubernetes cluster and configures Kong to proxy traffic
      Kong Gateway Operator
      Manage your Kong deployments on Kubernetes using YAML Manifests
      Insomnia
      Collaborative API development platform
      Kuma
      Open-source distributed control plane with a bundled Envoy Proxy integration
  • Plugin Hub
    • Explore the Plugin Hub
      View all plugins View all plugins View all plugins arrow image
    • Functionality View all View all arrow image
      View all plugins
      Authentication's icon
      Authentication
      Protect your services with an authentication layer
      Security's icon
      Security
      Protect your services with additional security layer
      Traffic Control's icon
      Traffic Control
      Manage, throttle and restrict inbound and outbound API traffic
      Serverless's icon
      Serverless
      Invoke serverless functions in combination with other plugins
      Analytics & Monitoring's icon
      Analytics & Monitoring
      Visualize, inspect and monitor APIs and microservices traffic
      Transformations's icon
      Transformations
      Transform request and responses on the fly on Kong
      Logging's icon
      Logging
      Log request and response data using the best transport for your infrastructure
  • Support
  • Community
  • Kong Academy
Get a Demo Start Free Trial
Kong Konnect
  • Home icon
  • Kong Konnect
  • Gateway Manager
  • Configuration
  • Vaults
  • Set Up and Use a Vault in Konnect
github-edit-pageEdit this page
report-issueReport an issue
  • Kong Gateway
  • Kong Konnect
  • Kong Mesh
  • Plugin Hub
  • decK
  • Kong Ingress Controller
  • Kong Gateway Operator
  • Insomnia
  • Kuma

  • Docs contribution guidelines
enterprise-switcher-icon Switch to OSS
On this pageOn this page
  • Set up a vault
  • Define a reference
  • Use the reference in configuration

Set Up and Use a Vault in Konnect

The following example shows you how to replace certificates used in Kong Gateway data plane nodes with a reference. You can do the same thing with any supported fields. This is the most basic form of secrets management.

Set up a vault

First, define your environment variables.

Open the Vaults page in Konnect:

  1. From the navigation menu, open runtimes icon Gateway Manager.
  2. Select a control plane.
  3. From the expanded control plane menu, open Vaults.

Set up a new vault. For this example, we’re going to use the environment variable vault.

  1. Click Add vault.
  2. Choose a vault type.
  3. Enter the configuration settings for your vault. For more information about how to configure settings, see the following Kong Gateway documentation:
    • AWS vault configuration options
    • Google Cloud vault configuration options
    • HashiCorp vault configuration options
    • Azure Key Vault configuration options
  4. Enter an environment variable prefix. This will be the prefix that the vault uses to recognize relevant values on the data plane.

    For this example, you can use MY_SECRET.

  5. Set a prefix that you want to use in references.

    For this example, use my-secret.

  6. Optionally, add a description for the vault, and tag it.

    Setting tags is optional, but recommended. If you want to manage your vault configuration declaratively, tagging your vaults and managing subsets of configuration with tags lets you protect your vaults from accidental change or deletion. See the declarative configuration guide for vaults for more information and best practices.

  7. Save the vault configuration.

Define a reference

Now that you have your environment variables set up, you can define references for them. This next step has to be configured on the data plane node.

For each data plane node that needs to use this vault, define an environment variable key and assign a secret to it.

export MY_SECRET_CERT="<cert data>" \
export MY_SECRET_KEY="<key data>"

Restart the data plane node to load the values.

Next, set up references to these environment variables in URL format so Kong Gateway can recognize these secrets.

In this case, the references would look like this:

{vault://env/my-secret-cert}
{vault://env/my-secret-key}
  • vault is a scheme that indicates that the value is a secret.
  • env defines the backend because you’re storing the secret in an environment variable.
  • my-secret-key and my-secret-cert correspond to the previously defined environment variables.

Use the reference in configuration

Now, you can reference the secrets in proxy configuration.

Set up a cert and key using these references:

  1. From your control plane side menu, open Certificates.
  2. Click Add certificate.
  3. In the Cert field, paste {vault://env/my-secret-cert}.
  4. In the Key field, paste {vault://env/my-secret-key}.
  5. Save to see your certificate added to the list.

The Konnect control plane can now access the certificates on the data plane nodes using the references you provided.

You can also store secrets in a secure vault backend. For a list of supported vault backend implementations, see the Backends Overview.

Thank you for your feedback.
Was this page useful?
Too much on your plate? close cta icon
More features, less infrastructure with Kong Konnect. 1M requests per month for free.
Try it for Free
  • Kong
    Powering the API world

    Increase developer productivity, security, and performance at scale with the unified platform for API management, service mesh, and ingress controller.

    • Products
      • Kong Konnect
      • Kong Gateway Enterprise
      • Kong Gateway
      • Kong Mesh
      • Kong Ingress Controller
      • Kong Insomnia
      • Product Updates
      • Get Started
    • Documentation
      • Kong Konnect Docs
      • Kong Gateway Docs
      • Kong Gateway Enterprise Docs
      • Kong Mesh Docs
      • Kong Insomnia Docs
      • Kong Konnect Plugin Hub
    • Open Source
      • Kong Gateway
      • Kuma
      • Insomnia
      • Kong Community
    • Company
      • About Kong
      • Customers
      • Careers
      • Press
      • Events
      • Contact
  • Terms• Privacy• Trust and Compliance
© Kong Inc. 2023