Home > front end >  Kong plugin store value in Kubernetes secret
Kong plugin store value in Kubernetes secret

Time:11-04

I have this KongPlugin on Kubernetes

apiVersion: configuration.konghq.com/v1
kind: KongPlugin
config: 
  remove:
    headers:
    - Authorization
  append:
    headers:
    - Authorization:Basic <SECRET>
plugin: request-transformer

Is it possible to move the header Authorization to a Kubernetes secret?

CodePudding user response:

if you are using the request-transformer Enterprise version you can do it.

config.append.headers optional

Type: array of string elements List of headername:value pairs. If the header is not set, set it with the given value. If it is already set, a new header with the same name and the new value will be set.

This field is referenceable, which means it can be securely stored as a secret in a vault. References must follow a specific format.

Ref : https://docs.konghq.com/hub/kong-inc/request-transformer-advanced/

There is no direct way as much i have tried if not exterprise version, but you can update or write the plugin code and create the docker image and run it.

Here is example code which append the headers : https://github.com/Kong/kong-plugin-request-transformer/blob/master/kong/plugins/request-transformer/access.lua#L228

You can read article do build custom docker image with plugin code : https://faun.pub/building-kong-custom-docker-image-add-a-customized-kong-plugin-2157a381d7fd

  • Related