Skip to content

Akeyless

Akeyless Secrets Management Platform

External Secrets Operator integrates with the Akeyless Secrets Management Platform.

Create Secret Store

SecretStore resource specifies how to access Akeyless. This resource is namespaced.

NOTE: Make sure the Akeyless provider is listed in the Kind=SecretStore. If you use a customer fragment, define the value of akeylessGWApiURL as the URL of your Akeyless Gateway in the following format: https://your.akeyless.gw:8080/v2.

For non-global SaaS tenants, set akeylessGWApiURL (or the AKEYLESS_URL environment variable on the operator, matching the Akeyless CLI) to the tenant URL, for example https://vault.eu.akeyless.io or https://api.eu.akeyless.io. Vault/UAM hosts are mapped to the matching api.* endpoint so authentication and secret fetches use the same tenant.

When using an Akeyless Gateway, you can set ignoreCache: true on the SecretStore to bypass the Gateway cache and fetch the latest secret value from Akeyless SaaS on every sync. This matches the ignore_cache option in the Akeyless Kubernetes Secrets Injector. Use this only when you need fresh values on each reconcile: it increases load on the Gateway and upstream Akeyless API compared to serving cached responses.

NOTE: ignoreCache also disables ESO's in-process item-type cache (described below), so every sync looks up the item type. It does not disable token reuse. ESO still reuses the provider client between reconciles when the SecretStore spec is unchanged.

ESO caches two things in memory for each provider client, which is created per SecretStore and namespace and replaced when the SecretStore spec changes:

  • Akeyless token: reused until the expiry returned by Akeyless authentication, minus 30 seconds. If no expiry is returned, the token is reused for about 4 minutes. If a request made with a cached token fails with HTTP 401 or 403, ESO discards the token and retries the request once with a fresh one.
  • Item type (static, dynamic, rotated or certificate): cached for 10 minutes, for up to 1024 items. If a read with a cached type fails, ESO looks up the item again in the same sync, so deleted items and items recreated as a different type are handled immediately.

To set the operator-wide AKEYLESS_URL environment variable with the Helm chart, use extraEnv.

Akeyless provides several Authentication Methods:

Authentication with Kubernetes

Options for obtaining Kubernetes credentials include:

  1. Using a service account jwt referenced in serviceAccountRef
  2. Using the jwt from a Kind=Secret referenced by the secretRef
  3. Using transient credentials from the mounted service account token within the external-secrets operator

Create the Akeyless Secret Store Provider with Kubernetes Auth-Method

apiVersion: external-secrets.io/v1
kind: SecretStore
metadata:
  name: akeyless-secret-store
spec:
  provider:
    akeyless:
      # URL of your akeyless API
      akeylessGWApiURL: "https://api.akeyless.io"
      authSecretRef:
        kubernetesAuth:
          accessID: "p-XXXXXX"
          k8sConfName: "my-conf-name"

          # Optional service account field containing the name
          # of a kubernetes ServiceAccount.
          # For ClusterSecretStore, namespace is required.
          serviceAccountRef:
            name: "my-sa"
            # namespace: "my-namespace"  # required for ClusterSecretStore

          # Optional secret field containing a Kubernetes ServiceAccount JWT
          # used for authenticating with Akeyless.
          # For ClusterSecretStore, namespace is required.
          secretRef:
            name: "my-secret"
            key: "token"
            # namespace: "my-namespace"  # required for ClusterSecretStore

NOTE: In case of a ClusterSecretStore, be sure to provide namespace for serviceAccountRef and secretRef according to the namespaces where the secrets reside.

Authentication with OAuth2.0/JWT

Use an Akeyless OAuth2.0/JWT auth method. The provider calls Akeyless Auth with access-type=jwt and the bearer JWT.

Preferred SecretStore shape is authSecretRef.jwtAuth:

apiVersion: external-secrets.io/v1
kind: SecretStore
metadata:
  name: akeyless-jwt-auth
  namespace: app-test
spec:
  provider:
    akeyless:
      akeylessGWApiURL: "https://api.akeyless.io"
      authSecretRef:
        jwtAuth:
          accessID: "p-xxxxxx"
          # Option A: JWT stored in a Secret (IdP-issued access/ID token)
          secretRef:
            name: akeyless-jwt
            key: token
          # Option B: mint a Kubernetes SA token via TokenRequest
          # (requires create on serviceaccounts/token — Helm rbac.serviceAccountTokenCreate, default true)
          # serviceAccountRef:
          #   name: akeyless-jwt-sa
          #   # required; must match the Akeyless auth method's --audience
          #   audiences:
          #     - "akeyless.io"
          # expirationSeconds: 600

JWT material:

apiVersion: v1
kind: Secret
metadata:
  name: akeyless-jwt
  namespace: app-test
type: Opaque
stringData:
  # Bearer JWT issued by your IdP for the Akeyless OAuth2.0/JWT auth method
  token: "YOUR_JWT_HERE"

jwtAuth.serviceAccountRef uses the TokenRequest API (create on serviceaccounts/token). The Helm chart grants this when rbac.serviceAccountTokenCreate is true (the default). serviceAccountRef.audiences is required and must match the audience configured on the Akeyless OAuth2.0/JWT auth method. This keeps the token from being scoped to the Kubernetes API server, so it cannot be replayed against the cluster API.

When jwtAuth is set, it takes precedence: authSecretRef.secretRef and authSecretRef.serviceAccountRef are ignored, and ESO returns a warning if they are also set.

Akeyless setup for ServiceAccount tokens

For serviceAccountRef, the Akeyless auth method must trust your cluster's ServiceAccount token issuer:

  1. Export the cluster JWKS and note the issuer. Refresh the JWKS in Akeyless when the cluster signing keys rotate.

    kubectl get --raw /openid/v1/jwks > cluster-jwks.json
    kubectl get --raw /.well-known/openid-configuration  # "issuer" field
    
  2. Create an OAuth2.0/JWT auth method that trusts that JWKS, with sub as the unique identifier and the same audience you set in serviceAccountRef.audiences:

    akeyless auth-method create oauth2 \
      --name /k8s/cluster-oidc \
      --jwks-json-file ./cluster-jwks.json \
      --issuer <issuer-from-openid-configuration> \
      --unique-identifier sub \
      --audience akeyless.io
    

    If the cluster JWKS is publicly reachable, you can use --jwks-uri instead of --jwks-json-file.

  3. Scope access per ServiceAccount with role associations on the sub claim:

    akeyless assoc-role-am --role-name <role> --am-name /k8s/cluster-oidc \
      --sub-claims sub=system:serviceaccount:<namespace>:<serviceaccount>
    

Alternatively, store accessType=jwt and put the JWT in accessTypeParam via the generic credentials Secret below.

Authentication with Cloud-Identity or Api-Access-Key

Akeyless providers require an access-id, access-type and access-type-param to set your SecretStore with an authentication method from Akeyless.

The supported auth-methods and their parameters are:

accessType accessTypeParam
aws_iam -
gcp The GCP audience
azure_ad Azure object ID (optional)
api_key The access key
access_key The access key (alias for api_key)
k8s The k8s configuration name
jwt The bearer JWT

For azure_ad on AKS Workload Identity, set authSecretRef.serviceAccountRef to a ServiceAccount annotated with azure.workload.identity/client-id and azure.workload.identity/tenant-id. This field is only used when accessType is azure_ad; other access types ignore it.

apiVersion: external-secrets.io/v1
kind: SecretStore
metadata:
  name: akeyless-azure-ad-wi
  namespace: app-test
spec:
  provider:
    akeyless:
      akeylessGWApiURL: "https://api.akeyless.io"
      authSecretRef:
        secretRef:
          accessID:
            name: akeyless-secret-creds
            key: accessId
          accessType:
            name: akeyless-secret-creds
            key: accessType
          accessTypeParam:
            name: akeyless-secret-creds
            key: accessTypeParam
        serviceAccountRef:
          name: akeyless-wi-sa

For ClusterSecretStore, set serviceAccountRef.namespace when the ServiceAccount is not in the same namespace as the consuming ExternalSecret; otherwise the ServiceAccount is resolved from that namespace. Sovereign Azure clouds (US Government, China) are supported when AZURE_ENVIRONMENT or AZURE_CLOUD is set accordingly, matching the non-WI GetCloudId path.

For more information see Akeyless Authentication Methods

Creating an Akeyless Credentials Secret

Create a secret containing your credentials using the following example as a guide:

apiVersion: v1
kind: Secret
metadata:
  name: akeyless-secret-creds
type: Opaque
stringData:
  accessId: "p-XXXX"
  accessType:  # one of: aws_iam / gcp / azure_ad / api_key / access_key / k8s
  accessTypeParam:  # optional -- one of: gcp-audience / azure-obj-id / access-key / k8s-conf-name

Create the Akeyless Secret Store Provider with the Credentials Secret

apiVersion: external-secrets.io/v1
kind: SecretStore
metadata:
  name: akeyless-secret-store
spec:
  provider:
    akeyless:
      # URL of your akeyless API
      akeylessGWApiURL: "https://api.akeyless.io"
      # ignoreCache: true  # bypass Gateway cache when using an Akeyless Gateway URL
      authSecretRef:
        secretRef:
          accessID:
            name: akeyless-secret-creds
            key: accessId
          accessType:
            name: akeyless-secret-creds
            key: accessType
          accessTypeParam:
            name: akeyless-secret-creds
            key: accessTypeParam

NOTE: In case of a ClusterSecretStore, be sure to provide namespace for accessID, accessType and accessTypeParam according to the namespaces where the secrets reside.

Create the Akeyless Secret Store With CAs for TLS handshake

....
spec:
  provider:
    akeyless:
      akeylessGWApiURL: "https://your.akeyless.gw:8080/v2"
      ignoreCache: true

      # Optional caBundle - PEM/base64 encoded CA certificate
      caBundle: "<base64 encoded cabundle>"
      # Optional caProvider:
      # Instead of caBundle you can also specify a caProvider
      # this will retrieve the cert from a Secret or ConfigMap
      caProvider:
        type: Secret  # Can be Secret or ConfigMap
        name: "<name of secret or configmap>"
        key: "<key inside secret>"
        # namespace is mandatory for ClusterSecretStore and not relevant for SecretStore
        namespace: "my-cert-secret-namespace"
  ....

Supported Secret Types

The provider supports the following Akeyless item types:

  • Static Secret -- standard key/value secret
  • Dynamic Secret -- ephemeral credentials generated on demand
  • Rotated Secret -- automatically rotated credentials
  • Certificate -- TLS/SSH certificates

Creating an external secret

To get a secret from Akeyless and create it as a secret on the Kubernetes cluster, a Kind=ExternalSecret is needed.

apiVersion: external-secrets.io/v1
kind: ExternalSecret
metadata:
  name: database-credentials
spec:
  refreshInterval: 1h0m0s

  secretStoreRef:
    kind: SecretStore
    name: akeyless-secret-store # Must match SecretStore on the cluster

  target:
    name: database-credentials # Name for the secret to be created on the cluster
    creationPolicy: Owner

  data:
    - secretKey: username # Key given to the secret to be created on the cluster
      remoteRef:
        key: db-username  # Full path of the secret on Akeyless
    - secretKey: password # Key given to the secret to be created on the cluster
      remoteRef:
        key: db-password  # Full path of the secret on Akeyless

Fetching a specific version

Use remoteRef.version to pin a specific secret version (integer). Omit the field or set it to 0 to get the latest version.

data:
  - secretKey: password
    remoteRef:
      key: /path/to/secret
      version: "3"  # fetch version 3 specifically

Extracting a property from a JSON secret

If the secret value is a JSON object, use remoteRef.property to extract a single key. Nested keys can be addressed with dot notation; literal dots in key names are escaped with a backslash (key\.with\.dots).

data:
  - secretKey: db-password
    remoteRef:
      key: /path/to/json-secret
      property: password  # extracts {"password": "..."} from the JSON value

Using DataFrom

DataFrom can be used to get a secret as a JSON string and attempt to parse it, creating one Kubernetes secret key per JSON field.

apiVersion: external-secrets.io/v1
kind: ExternalSecret
metadata:
  name: database-credentials
spec:
  refreshInterval: 1h0m0s

  secretStoreRef:
    kind: SecretStore
    name: akeyless-secret-store # Must match SecretStore on the cluster

  target:
    name: database-credentials-json # Name for the secret to be created on the cluster
    creationPolicy: Owner

  # for json formatted secrets: each key in the json will be used as the secret key in the SECRET k8s target object
  dataFrom:
  - extract:
      key: database-credentials # Full path of the secret on Akeyless

When the secret contains nested JSON objects, use extract.property to select a subtree before parsing. This is useful when only part of the secret should be synced (for example, extracting a db object while ignoring other top-level keys like apiKey).

apiVersion: external-secrets.io/v1
kind: ExternalSecret
metadata:
  name: database-credentials
spec:
  refreshInterval: 1h0m0s

  secretStoreRef:
    kind: SecretStore
    name: akeyless-secret-store # Must match SecretStore on the cluster

  target:
    name: database-credentials-json # Name for the secret to be created on the cluster
    creationPolicy: Owner

  # Extract only the "db" object from a JSON secret and create one Kubernetes
  # secret key per field inside it (e.g. username, password).
  dataFrom:
  - extract:
      key: database-credentials # Full path of the secret on Akeyless
      property: db

Given an Akeyless static secret with value:

{
  "db": {
    "username": "my_user",
    "password": "my_pass"
  },
  "apiKey": "myApiKey"
}

The example above creates a Kubernetes secret with keys username and password. Non-string JSON values (numbers, booleans, nested objects) are preserved as their JSON representation.

Note: extract.property requires the secret value to be valid JSON. It works reliably with Static Secrets. Dynamic and Rotated secrets may return provider-specific JSON envelopes; use remoteRef.property with spec.data for individual fields in those cases.

Finding secrets by name or tag

Use dataFrom.find to bulk-fetch secrets matching a name pattern or tag:

# by name regex
dataFrom:
  - find:
      path: /my/path/         # optional path prefix
      name:
        regexp: ".*db.*"

# by tag
dataFrom:
  - find:
      tags:
        env: production

Getting the Kubernetes Secret

The operator will fetch the secret and inject it as a Kind=Secret.

kubectl get secret database-credentials -o jsonpath='{.data.db-password}' | base64 -d
kubectl get secret database-credentials-json -o jsonpath='{.data}'

Pushing a secret

To push a secret from Kubernetes cluster and create it as a secret to Akeyless, a Kind=PushSecret resource is needed.

apiVersion: external-secrets.io/v1alpha1
kind: PushSecret
metadata:
 name: push-secret
spec:
 refreshInterval: 1h0m0s
 updatePolicy: Replace
 deletionPolicy: Delete
 secretStoreRefs:
   - name: akeyless-secret-store
     kind: SecretStore
 selector:
   secret:
     name: k8s-created-secret
 data:
   - match:
      remoteRef:
        remoteKey: eso-created/my-secret

Then when you create a matching secret as follows:

kubectl create secret generic --from-literal=cache-pass=mypassword k8s-created-secret

Then it will create a secret in akeyless eso-created/my-secret with value {"cache-pass":"mypassword"}