Skip to content
An app and container for authenticating services to @hashicorp Vault's via the Kubernetes auth method
Go Dockerfile
Branch: master
Clone or download

Latest commit

Fetching latest commit…
Cannot retrieve the latest commit at this time.


Type Name Latest commit message Commit time
Failed to load latest commit information.
.github Create reaction.yml Aug 3, 2018
Dockerfile Add namespace support Aug 11, 2019
LICENSE Add namespace support Aug 11, 2019
go.sum Add namespace support Aug 11, 2019


The vault-kubernetes-authenticator is a small application/container that performs the HashiCorp Vault kubernetes authentication process and places the Vault token in a well-known, configurable location. It is most commonly used as an init container to supply a Vault token to applications or services that are unaware of Vault.


  • VAULT_ADDR - the address to the Vault server, including the protocol and port (like https://my.vault.server:8200). This defaults to if unspecified.

  • VAULT_CAPEM - the raw PEM contents of the CA file to use for SSL verification.

  • VAULT_CACERT - the path on disk to a single CA file to use for TSL verification.

  • VAULT_CAPATH - the path on disk to a directory of CA files (non-recursive) to use for TLS verification.

  • VAULT_SKIP_VERIFY - disable SSL validation (not recommended)

  • VAULT_ROLE - Required the name of the Vault role to use for authentication.

  • VAULT_NAMESPACE - the Vault namespace, only available in Vault Enterprise

  • TOKEN_DEST_PATH - the destination path on disk to store the token. Usually this is a shared volume. Defaults to /var/run/secrets/

  • ACCESSOR_DEST_PATH - the destination path on disk to store the accessor. Usually this is a shared volume. Defaults to /var/run/secrets/

  • SERVICE_ACCOUNT_PATH - the path on disk where the kubernetes service account jtw token lives. This defaults to /var/run/secrets/

  • VAULT_K8S_MOUNT_PATH - the name of the mount where the Kubernetes auth method is enabled. This defaults to kubernetes, but if you changed the mount path you will need to set this value to that path.

    vault auth enable -path=k8s kubernetes -> VAULT_K8S_MOUNT_PATH=k8s

Example Usage

apiVersion: v1
kind: Pod
  name: vault-auther
    runAsUser: 1001
    fsGroup: 1001

  - name: vault-auth
      medium: Memory
  - name: vault-secrets
      medium: Memory

  - name: vault-authenticator
    image: sethvargo/vault-kubernetes-authenticator:0.2.0
    imagePullPolicy: Always
    - name: vault-auth
      mountPath: /var/run/secrets/
    - name: VAULT_ROLE
      value: myapp-role
      allowPrivilegeEscalation: false

    # Your other containers would read from /home/vault/.vault-token, or set
    # HOME to /home/vault
  - name: consul-template
    image: hashicorp/consul-template:0.19.5.alpine
    - name: vault-auth
      mountPath: /home/vault
    - name: vault-secrets
      mountPath: /var/run/secrets/
    - name: HOME
      value: /home/vault

  # ...
You can’t perform that action at this time.