> For clean Markdown of any page, append .md to the page URL. For a complete documentation index, see https://ibee.ai/docs/llms.txt (full text of every page: https://ibee.ai/docs/llms-full.txt). For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://ibee.ai/docs/_mcp/server.

# Kubernetes with External Secrets

> Sync IBEE Secret Manager secrets into Kubernetes Secrets with External Secrets Operator (ESO) and an app credential - install ESO, store the Secret ID, create a SecretStore and an ExternalSecret, use TLS and registry templates, choose a refresh interval, and fix sync errors.

External Secrets Operator (ESO) runs in your Kubernetes cluster, signs in to Secret Manager with an [app credential](/docs/tools/secret-manager/app-credentials), and copies secrets into ordinary Kubernetes Secrets that your pods use. It reads Secret Manager through ESO's Vault provider (KV version 2), so no IBEE-specific software is needed. This works with any Kubernetes cluster that can reach your workspace's address.

## How it works

1. You store the app credential's **Secret ID** in a Kubernetes Secret.
2. A **SecretStore** tells ESO the address, namespace and Role ID.
3. Each **ExternalSecret** names a secret in Secret Manager (for example `payments/db`) and the Kubernetes Secret to create.
4. ESO reads it and creates the Kubernetes Secret, then reads it again at every **refresh interval**. Each read is a billed operation.

## Before you begin

* A cluster, `kubectl` and `helm`.
* An app credential, preferably **Read only** and limited to the application's folder (for example `payments`), with its Role ID and Secret ID. See [Create an app credential](/docs/tools/secret-manager/app-credentials#create-an-app-credential).
* Your workspace's address and namespace from Secret Manager → **Connect**.

## Steps

### Install External Secrets Operator

Skip this if ESO is already installed.

```bash
helm repo add external-secrets https://charts.external-secrets.io
helm upgrade --install external-secrets external-secrets/external-secrets \
  --namespace external-secrets --create-namespace
```

The examples use the `external-secrets.io/v1` API. Check that your ESO version serves it:

```bash
kubectl api-resources --api-group=external-secrets.io
```

### Store the Secret ID in the cluster

Create the Secret in the namespace where your application runs (here `example-app`):

```bash
kubectl create secret generic ibee-app-credential \
  --namespace example-app \
  --from-literal=secret-id="$SECRET_ID"
```

### Create a SecretStore

**`secretstore.yaml`**

```yaml title="secretstore.yaml"
apiVersion: external-secrets.io/v1
kind: SecretStore
metadata:
  name: ibee-secret-manager
  namespace: example-app
spec:
  provider:
    vault:
      server: https://secrets.ibee.ai      # your address from Connect
      namespace: acme-payments              # your namespace
      path: secret
      version: v2
      auth:
        appRole:
          path: approle
          roleId: <role ID of the app credential>
          secretRef:
            name: ibee-app-credential
            key: secret-id
```

```bash
kubectl apply -f secretstore.yaml
```

### Create an ExternalSecret

This copies every key of `payments/db` into a Kubernetes Secret named `payments-db`:

**`externalsecret.yaml`**

```yaml title="externalsecret.yaml"
apiVersion: external-secrets.io/v1
kind: ExternalSecret
metadata:
  name: payments-db
  namespace: example-app
spec:
  refreshInterval: 1h
  secretStoreRef:
    name: ibee-secret-manager
    kind: SecretStore
  target:
    name: payments-db
    creationPolicy: Owner
  dataFrom:
    - extract:
        key: payments/db
```

```bash
kubectl apply -f externalsecret.yaml
```

To copy only some keys, use `data` instead of `dataFrom`:

```yaml
  data:
    - secretKey: DB_PASSWORD          # key in the Kubernetes Secret
      remoteRef:
        key: payments/db              # path in Secret Manager
        property: password            # key inside the secret
```

### Use it in a pod

```yaml
    containers:
      - name: app
        image: registry.example.com/payments-api:1.4.2
        envFrom:
          - secretRef:
              name: payments-db
```

## Verify it worked

```bash
kubectl get secretstore ibee-secret-manager -n example-app      # STATUS Valid, READY True
kubectl get externalsecret payments-db -n example-app           # STATUS SecretSynced, READY True
kubectl get secret payments-db -n example-app -o jsonpath='{.data}' | jq 'keys'
```

## Read IBEE-managed secrets

Credentials that IBEE products create live in the read-only `ibee-managed/` store. Add a second SecretStore with `path: ibee-managed` and reference it from the ExternalSecret. Only a credential **without a folder** can read `ibee-managed/`.

```yaml
apiVersion: external-secrets.io/v1
kind: SecretStore
metadata:
  name: ibee-secret-manager-managed
  namespace: example-app
spec:
  provider:
    vault:
      server: https://secrets.ibee.ai
      namespace: acme-payments
      path: ibee-managed
      version: v2
      auth:
        appRole:
          path: approle
          roleId: <role ID of the app credential>
          secretRef:
            name: ibee-app-credential
            key: secret-id
```

## TLS certificates and registry logins

Use a `template` to create a Kubernetes Secret of a specific type.

A TLS secret, from a secret in Secret Manager with the keys `tls.crt` and `tls.key`:

```yaml
  target:
    name: shop-tls
    template:
      type: kubernetes.io/tls
  dataFrom:
    - extract:
        key: shop/tls
```

A registry pull secret, from a secret with the keys `registry`, `username` and `password`:

```yaml
  target:
    name: registry-pull
    template:
      type: kubernetes.io/dockerconfigjson
      data:
        .dockerconfigjson: '{"auths":{"{{ .registry }}":{"username":"{{ .username }}","password":"{{ .password }}"}}}'
  dataFrom:
    - extract:
        key: ci/registry
```

## Choose a refresh interval

ESO reads each secret again at every `refreshInterval`. Each read is a billed operation (₹4 per 10,000), so a short interval costs more and gives little: most applications only pick up a new value when their pods restart.

| `refreshInterval`  | Reads per secret per month | Cost per secret per month |
| ------------------ | -------------------------- | ------------------------- |
| `1m`               | 43,200                     | ₹17.28                    |
| `5m`               | 8,640                      | ₹3.46                     |
| `1h` (recommended) | 720                        | ₹0.29                     |
| `24h`              | 30                         | ₹0.01                     |

* `dataFrom.extract` reads the whole secret once. Several `data` entries that point at the same secret may each be read separately.

* To pick up a change at once, without waiting for the interval:

  ```bash
  kubectl annotate externalsecret payments-db -n example-app force-sync=$(date +%s) --overwrite
  ```

* Values loaded with `envFrom` or `env` change only when the pod restarts. Secrets mounted as volumes update in place. Tools such as Stakater Reloader can restart a Deployment when its Secret changes.

## Shared clusters

A **ClusterSecretStore** lets every namespace in the cluster read everything its app credential can read. When several teams or applications share a cluster, give each Kubernetes namespace its own **SecretStore** with its own app credential, limited to that application's folder.

## Troubleshooting

Start with `kubectl describe externalsecret <name> -n <namespace>` and `kubectl describe secretstore <name> -n <namespace>`.

| You see                                                                    | What it means                                                                                      | What to do                                                |
| -------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | --------------------------------------------------------- |
| SecretStore not ready, with a `400` on login about the role or secret ID   | Wrong Role ID or Secret ID, or the Secret ID was replaced                                          | Issue a new Secret ID and update `ibee-app-credential`    |
| `permission denied`                                                        | The credential's folder doesn't include the path, or it's folder-limited and reads `ibee-managed/` | Use a credential for that folder, or one without a folder |
| `namespace not found`, or a `404`                                          | `namespace:` is wrong or missing                                                                   | Copy it from **Connect**                                  |
| `429` in ESO logs                                                          | Too many reads from the cluster's IP address                                                       | Raise `refreshInterval`                                   |
| The Kubernetes Secret updated but the app still has the old value          | The app reads it as environment variables                                                          | Restart the pods, or mount the Secret as a volume         |
| `no matches for kind "ExternalSecret" in version "external-secrets.io/v1"` | Your ESO version doesn't serve the `v1` API                                                        | Upgrade ESO                                               |

## Related pages

* [App credentials](/docs/tools/secret-manager/app-credentials)
* [Read secrets from your app](/docs/tools/secret-manager/connect-apps)
* [Pricing](/docs/tools/secret-manager/pricing)