External Secrets Management (Vault Integration) in Kubernetes

External Secrets Management (Vault Integration) in Kubernetes

A friendly, step-by-step guide to keeping passwords, keys and tokens out of your cluster files and in a proper vault: why built-in secrets are not enough, how Vault fits in, the main integration patterns, and how to secure, run and troubleshoot them.

Imagine a large hotel with hundreds of rooms. The master keys, the safe combinations and the alarm codes have to be kept somewhere. One option is to write them all on sticky notes and put the notes in each manager’s desk drawer. It is convenient, and it works, until a drawer is left open, a manager leaves the company with a photocopy, or somebody needs to change a code and has to find every note. The better option is a proper key room with a guard, a logbook and keys that expire on their own.

Kubernetes has the sticky-note option built in. It is called a Secret, and it is fine for getting started. For serious work, teams move their secrets to a proper key room outside the cluster, and connect the cluster to it. The most famous key room is HashiCorp Vault, and this guide shows how that connection works.

We build the idea from zero. Every new word is explained the first time it appears, and every big idea comes with an everyday comparison so it sticks. By the end you will know why external secrets management exists, how the main integration patterns differ, how to choose between them, and how to keep the whole arrangement safe and healthy.

1What Is External Secrets Management?

To understand external secrets management we first need a handful of simple words: secret, cluster, vault, identity and lease.

Word 1

Secret

A secret is any small piece of sensitive data that an application needs, such as a database password, an access key, a certificate or a token.

Word 2

Cluster

A cluster is the group of computers that Kubernetes manages together as one platform for running applications.

Word 3

Vault

A vault, in this guide, is a dedicated system that stores secrets safely, controls who may read them, and keeps a record of every access.

Word 4

Identity

An identity is proof of who is asking. For a person it might be a login. For a pod it is a signed token issued by the cluster.

Word 5

Policy

A policy is a written rule that says which identity may do what to which secret, for example “this application may read this one password”.

Word 6

Lease

A lease is a time limit attached to a secret. When the lease ends, the secret stops working, unless it is renewed.

So what exactly is external secrets management?

External secrets management means storing your secrets in a dedicated system outside the cluster, and letting your applications receive them from there when they need them. The cluster does not hold the master copy. It only carries a short-lived, narrowly permitted copy to the pod that needs it, and the vault keeps the record of who asked and when.

The important idea is separation of duties. Kubernetes is excellent at running applications. A vault is excellent at guarding secrets. Each does the job it was built for, and a small piece of glue connects them. That glue can be a helper container, an operator that copies values into the cluster, or a driver that mounts secrets as files. We meet all of them in later chapters.

Everyday analogy

Think of a bank. Customers keep valuables in the bank’s vault, not in a drawer at home. When a customer needs something, the bank checks their identity, opens the right box, writes it in the log, and lets the customer take only what they need. The customer’s home is the cluster, the bank vault is Vault, and the identity check is what makes the whole system trustworthy.

The three promises of a good secrets system

Promise 1

Only the right identity gets a secret

Every request is checked against a policy. A pod receives the secrets that belong to it and nothing else.

Promise 2

Every access leaves a trail

Each read is recorded, so you can answer who fetched which secret, from where, and when.

Promise 3

Secrets can change or expire

Passwords can be rotated centrally, and short-lived secrets disappear on their own, limiting the damage of a leak.

A short history

In the early days of containers, teams put passwords in configuration files, environment settings and even inside container images. Kubernetes introduced its own Secret object to give these values a proper home. Later, as companies grew and auditors asked harder questions, teams needed central control, rotation and audit logs that the built-in object was never designed to provide. Dedicated secret managers matured, and integration tools grew up around them. Today the pairing of a cluster with an external manager is a common pattern in production platforms.

i
Tip

Vault is one of several good options. Every major cloud offers its own secret manager, and the ideas in this guide apply to them too. We use Vault as the running example because it shows every concept in its clearest form.

2The Problem It Solves

Kubernetes Secrets look safe, but they hide a few uncomfortable facts. Understanding them is the reason the whole topic exists.

What is wrong with sticky notes?

A built-in Kubernetes Secret is stored in the cluster’s database, called etcd. By default the values there are only encoded, not encrypted. Encoding is like writing a message in a different alphabet that anyone can read back with a simple tool. It hides nothing from a determined reader. Encryption at rest can be switched on, but it is a setting someone must remember, and it protects only the disk, not the people and programs that are allowed to ask for the secret.

Headache 1

Encoded, not encrypted

Without extra settings, anyone who can read the cluster’s database or a backup of it can read every secret.

Headache 2

Broad reach

Anyone allowed to create a pod in a namespace can mount that namespace’s secrets. Access is coarse.

Headache 3

Secrets in files and repositories

Teams keep secret definitions in version control so that deployments are repeatable, and the passwords end up in history forever.

Headache 4

Painful rotation

Changing a password means updating every copy and restarting every user. Many teams simply never do.

Headache 5

Thin audit trail

It is hard to answer who read a specific secret and when, especially for reads by running pods.

Headache 6

Many clusters, many copies

The same password copied into several clusters becomes many places to guard and update.

What people did before

Old approachHow it workedWhy it hurt
Passwords in the container imageSecrets were baked in when the image was builtAnyone who could pull the image could read them, and changing them meant rebuilding
Passwords in environment settingsValues were typed into the deployment definitionVisible to anyone who can read the definition, and often printed in logs
Secrets committed to version controlSecret objects were kept beside the codePasswords sat in history and were copied to every clone
Manual copy and pasteAdministrators copied values by hand between systemsSlow, error-prone and impossible to audit
flowchart LR
  subgraph W["Built-in secrets only"]
    A1["Password typed into a file"] --> B1["File stored in version control"]
    B1 --> C1["Copied to the cluster database"]
    C1 --> D1["Readable by many people and tools"]
  end
  subgraph V["With an external vault"]
    A2["Password created in the vault"] --> B2["Pod proves its identity"]
    B2 --> C2["Vault checks policy and hands over a short-lived copy"]
    C2 --> D2["Every access is logged"]
  end
    
Figure 1. Built-in secrets spread copies widely. An external vault keeps one master copy and hands out short-lived ones.

Reading Figure 1

The left half shows how a password travels when only built-in secrets are used. Someone types it into a file, the file goes into version control, and it is copied into the cluster’s database, where many people and tools may read it. Each step creates another copy that must be guarded. The right half shows the vault approach. The password is created in the vault and stays there. When a pod needs it, the pod proves its identity, the vault checks the policy and hands over a short-lived copy, and the access is logged. There is one master copy, and every use leaves a trail.

Everyday analogy

Picture a company that writes the safe combination on a whiteboard so that everyone can find it. It works until someone leaves. A better company keeps the combination with a security officer who opens the safe for named people, writes each visit in a log, and changes the combination on a schedule.

1
master copy of each secret, guarded in the vault
0
passwords needed in version control or container images
100%
of reads recorded, when audit logging is switched on

3Core Concepts You Need First

A few building blocks appear again and again in Vault and in every integration. Learn them once and everything else will make sense.

Block 1

Secrets engine

A plug-in inside Vault that stores or creates secrets. One engine stores fixed values, another creates database logins on demand, another issues certificates.

Block 2

Auth method

A way for a caller to prove who it is. People may log in with a company account. Pods use the cluster’s own identity.

Block 3

Token

A short-lived pass that Vault gives to a caller after a successful login. Every later request carries the pass.

Block 4

Policy

The rules attached to a pass, listing which paths of secrets the holder may read, write or list.

Block 5

Role

A named mapping that says: pods with this service account, in this namespace, receive these policies.

Block 6

Audit device

A log destination where Vault writes a record of every request and response, with sensitive values protected.

Static and dynamic secrets

Vault can hand out two very different kinds of secrets. A static secret is a fixed value stored in Vault, such as an API key issued by a partner. Vault keeps it safe and controls access, but the value itself stays the same until someone changes it. A dynamic secret is created on demand. When an application asks for database access, Vault connects to the database, creates a brand-new user with a random password, hands the credentials to the application, and deletes the user automatically when the lease ends. Every application instance gets its own login, and stolen credentials expire on their own.

KindWhere the value comes fromLifetimeBest for
StaticStored by a person or a pipelineUntil someone changes itThird-party keys, legacy systems
DynamicCreated by Vault at the moment of requestLimited by the lease, then removedDatabases, cloud access, certificates
Everyday analogy

A static secret is like a house key that stays the same until you change the lock. A dynamic secret is like a hotel key card that is created when you check in, works only for your stay, and stops working automatically when you check out. If a card is lost, the harm ends by itself.

Three ideas to keep straight

Authentication

Proving who you are. In a cluster, a pod proves it by presenting its service account token, a signed pass issued by Kubernetes.

Authorisation

Deciding what an identity may do. In Vault this is the job of policies, attached to the pass after login.

Audit

Recording what happened. Vault’s audit devices write who asked for what, and when, so that reviews and investigations are possible.

The sealed vault

Vault stores its data encrypted. The key that unlocks it is itself protected, and when Vault starts it is sealed: it cannot read anything until it is unsealed. This is a deliberate safety feature. A stolen copy of Vault’s storage is useless without the unseal keys. In many setups, unsealing is automated using a cloud key service, so that restarts do not need a human to type keys at three in the morning.

!
Watch out

A sealed vault answers no requests. If Vault restarts and cannot unseal itself, every application that depends on it at start-up will wait. Plan unsealing and availability as carefully as you plan the secrets themselves.

4Architecture and Components

Several pieces cooperate between a pod and a stored secret. It helps to see who talks to whom.

flowchart TB
  POD["Application pod with a service account"] -->|"Shows identity token"| AUTH["Vault auth method for Kubernetes"]
  AUTH -->|"Asks the cluster: is this token genuine?"| API["Kubernetes API server"]
  API -->|"Yes, this pod belongs to this service account and namespace"| AUTH
  AUTH -->|"Issues a short-lived Vault token with policies"| POD
  POD -->|"Requests a secret using the token"| ENG["Secrets engine"]
  ENG --> STORE["Encrypted storage"]
  ENG --> AUD["Audit log"]
  OP["Helper: injector, operator or CSI driver"] -.->|"Does the fetching for the pod"| POD
    
Figure 2. The main pieces: pod identity, Vault’s auth method, the cluster’s API, secrets engines, storage and audit.

Reading Figure 2 piece by piece

Follow the arrows from the top left. An application pod carries an identity token issued by Kubernetes. It shows the token to Vault’s Kubernetes auth method. Vault does not simply trust the token. It asks the cluster’s own API server whether the token is genuine and which service account and namespace it belongs to. When the cluster confirms, Vault looks up the matching role, issues its own short-lived token carrying the right policies, and hands it back.

With that token, the pod can ask a secrets engine for a value. The engine reads from encrypted storage and writes an entry to the audit log. In practice, the pod’s application rarely does all this itself. A helper, drawn with a dotted line, does the fetching on its behalf. That helper may be an injector, an operator or a storage driver, and we compare them in Chapter 7.

The parts, one by one

Part

Vault server cluster

Usually several Vault servers working together for availability, with data stored in an encrypted store, often Vault’s own integrated storage.

Part

Kubernetes auth method

The Vault component that verifies pod identities by asking the cluster and maps them to roles.

Part

Service account

The identity a pod uses inside the cluster. The pod receives a signed token for it automatically.

Part

Helper component

An injector that adds a helper container, an operator that copies values into cluster secrets, or a driver that mounts them as files.

Part

Audit devices

Destinations for the detailed access records. Vault can refuse to serve requests if it cannot write them, for safety.

Part

Unseal mechanism

The way Vault unlocks its data at start-up, manual or automatic through a cloud key service.

Where Vault runs

Vault can run outside the cluster on dedicated machines, inside the same cluster, or in a separate management cluster. Running it outside the workload cluster is the classic choice: the vault does not depend on the thing it protects, and a problem in the cluster cannot take the vault down with it. Running it inside is simpler to operate for small teams but needs extra care, because the cluster now depends on a component that runs on the cluster. Many organisations use a dedicated platform cluster or machines for Vault and let many workload clusters connect to it.

Everyday analogy

Think of an airport. Passengers show a boarding pass, the desk checks it against the airline’s records rather than trusting the paper, and a stamp records the check. The airline’s records are Kubernetes’ API, the boarding pass is the pod’s token, and the desk is Vault’s auth method. A helper agent may walk the passenger through the process.

i
Tip

When something fails, work out which of three stages broke: proving identity, being authorised for the secret, or delivering the secret into the pod. Each has its own clues, and this guide gives you a routine for all three.

5How Vault Integration Works Internally

Now let us open the box. We will follow the login step by step, then see how policies, leases and renewals work.

The login: proving a pod is who it says it is

Every pod in Kubernetes runs under a service account, and the cluster gives the pod a signed token for that account. The token contains claims such as the account’s name, its namespace and an expiry time. When the pod shows this token to Vault, Vault passes it to the cluster’s token review service, which answers whether the token is valid and who owns it. Only after a positive answer does Vault look for a matching role.

flowchart TD
  S["Pod presents its service account token"] --> A{"Does the cluster confirm the token is genuine and not expired?"}
  A -->|"No"| X["Login refused"]
  A -->|"Yes"| B{"Does a Vault role name this service account?"}
  B -->|"No"| X
  B -->|"Yes"| C{"Is the pod's namespace allowed by the role?"}
  C -->|"No"| X
  C -->|"Yes"| D["Vault issues a short-lived token with the role's policies"]
  D --> E["Pod can read only what those policies allow"]
    
Figure 3. The gatekeeping questions Vault asks before it hands out a token.

Reading Figure 3

The flow has three checkpoints, each one a chance to say no. First, the cluster itself must confirm the token is genuine and unexpired, so a forged or stale pass fails immediately. Second, a Vault role must exist that names this exact service account, so a genuine pod with no matching role gets nothing. Third, the pod’s namespace must be one the role allows, so a service account with the same name in a different namespace is turned away. Only when all three pass does Vault issue a token, and that token carries only the policies attached to the role.

Roles bind identity to permissions

A role is the bridge between the cluster’s world and Vault’s world. It says, in effect: “pods running as this service account in this namespace may log in, and while logged in they receive these policies and this token lifetime”. A well-designed role is narrow. It names specific accounts and specific namespaces, rather than allowing everyone, and attaches policies that reach only the secrets that application really needs.

Policies name paths

A policy lists paths in Vault, such as the path of one application’s database credentials, together with the actions allowed there, like read or list. Anything not listed is denied. This default-deny design means a forgotten path is safe rather than open.

Tokens are short-lived

The token Vault issues has a time to live. The client must renew it before it expires or log in again. A stolen token therefore stops working soon on its own.

Leases attach to secrets

Dynamic secrets come with a lease. The holder may renew the lease up to a maximum age. When the lease ends or is revoked, Vault deletes the underlying credential, such as the temporary database user.

Versioned static secrets

Vault’s key-value engine can keep several versions of a static secret, so a bad change can be rolled back and the history of changes can be reviewed.

Everyday analogy

Picture a conference. You show your passport at the door, and the desk checks it against the organisers’ list, not just the paper in your hand. If you are on the list, you receive a badge with coloured stripes that open only certain rooms, and the badge expires at the end of the day. The passport is the service account token, the list is the role, the stripes are policies and the expiry is the token lifetime.

Why this design resists theft

An attacker who steals a service account token still needs the cluster to confirm it, so an expired token fails. An attacker who steals a Vault token gets only the policies of that role, and only until the token expires. An attacker who steals a dynamic database credential holds something that will delete itself. Each layer limits the damage of the layer before it, which is the whole point of the design.

!
Watch out

The strength of this scheme rests on narrow roles. A role that allows any service account in any namespace, with broad policies, turns the whole system into a very elaborate way of giving everyone every secret.

6Data Flow and Lifecycle

Let us follow one secret from the moment a pod starts to the moment the pod is gone.

sequenceDiagram
  participant P as Pod helper
  participant K as Kubernetes API
  participant V as Vault
  participant D as Database
  P->>V: Log in with service account token
  V->>K: Is this token genuine?
  K-->>V: Yes, account and namespace
  V-->>P: Short-lived Vault token
  P->>V: Request database credentials
  V->>D: Create a temporary user
  D-->>V: User created
  V-->>P: Credentials with a lease
  P->>P: Write credentials for the application
  P->>V: Renew the lease before it ends
  P->>V: Pod ends, credentials revoked
  V->>D: Remove the temporary user
    
Figure 4. The life of a dynamic secret, from login to revocation.

Reading Figure 4

The story begins with the helper in the pod logging in to Vault with the service account token. Vault confirms the token with the cluster and returns its own short-lived token. The helper then asks for database credentials. Vault connects to the database and creates a temporary user, returns the credentials with a lease, and the helper writes them where the application can read them. While the pod lives, the helper renews the lease before it runs out. When the pod ends, the credentials are revoked and Vault removes the temporary user from the database, leaving nothing behind.

Six stages of a secret’s life

Stage 1

Login

The pod proves its identity and receives a short-lived Vault token.

Stage 2

Request

The helper asks for a specific secret. Vault checks the policy first.

Stage 3

Delivery

The value reaches the pod as a file, an environment value or a cluster secret, depending on the pattern used.

Stage 4

Use

The application reads the value and uses it, for example to open a database connection.

Stage 5

Renewal or rotation

Leases are renewed, and changed static values are picked up again, sometimes with a restart.

Stage 6

Revocation

When the pod ends or the lease expires, the secret stops working and dynamic credentials are deleted.

Three ways to handle rotation

Rotation means changing a secret on a schedule or after an incident. There are three broad strategies, and each suits different applications.

Rotate and restart

The simplest approach: change the value in the vault, then restart the workloads so they read the new one. A reloader tool can automate the restart when it notices a change. It is easy to reason about, and it causes a brief rolling restart for every rotation.

Rotate and refresh in place

A sidecar or operator updates the file or cluster secret, and the application rereads it without restarting. This needs an application that watches its configuration and reopens connections gracefully. It gives smooth rotation, and only suits applications built for it.

Overlap with two valid values

The system accepts both the old and new value for a short time, so applications can switch at their own pace. Dynamic secrets do this naturally, because every pod holds its own credential with its own lease. For static values, teams create a second credential before retiring the first.

Whichever strategy you use, rehearse it. A rotation that has never been tested is an outage waiting for a calendar date.

What if something goes wrong?

If Vault is unreachable at start-up, the helper cannot fetch secrets and the pod usually waits or fails, depending on how the helper is set up. If Vault becomes unreachable later, the application keeps using the values it already has until they expire. Long leases therefore give resilience, and short leases give safety. If a secret is rotated while pods are running, applications that read the value only at start-up keep the old one until they restart or reload. This is why rotation needs a plan for how running applications learn about new values.

When a pod is rescheduled

The new pod logs in again and receives its own credentials. The old pod’s credentials are revoked. No secret is shared between the two.

When a static secret is changed

Applications need to learn the new value. Helpers that refresh files, or tools that restart workloads when a secret changes, close the gap.

When a token or lease is about to expire

The helper renews it. If renewal fails, it logs in again. If that fails too, the pod is left holding a value that will soon stop working, and alerts should fire.

Everyday analogy

Think of a hotel stay. Check-in creates a key card. During the stay, the card may be extended day by day. At check-out, the card is cancelled and the room reset. If the front desk goes offline mid-stay, guests with valid cards still enter their rooms, but new guests wait in the lobby.

i
Tip

Decide upfront what your application should do when Vault is briefly unavailable: wait and retry, keep running on cached values, or fail loudly. Then test that behaviour before production does it for you.

7Integration Patterns: Injector, Operators and CSI

There are several ways to carry a secret from Vault into a pod. Each has its own personality, strengths and traps.

flowchart TB
  subgraph I["Pattern A: Agent injector"]
    I1["Webhook adds helper containers to the pod"] --> I2["Helper logs in and fetches secrets"] --> I3["Writes files to a shared memory folder"]
  end
  subgraph O["Pattern B: Operator that syncs"]
    O1["Operator watches custom resources"] --> O2["Fetches from the vault"] --> O3["Creates or updates a cluster secret"]
  end
  subgraph C["Pattern C: CSI driver"]
    C1["Pod declares a secrets volume"] --> C2["Driver fetches at pod start"] --> C3["Mounts secrets as files"]
  end
  subgraph D["Pattern D: Application talks to Vault"]
    D1["Application uses a client library"] --> D2["Logs in and reads directly"]
  end
    
Figure 5. Four ways of carrying a secret from the vault into a pod.

Reading Figure 5

Each box shows a different road. In pattern A, a special component watches for new pods and quietly adds helper containers to those that ask for secrets. The helpers log in, fetch the values and write them as files into a shared memory folder that the application reads. In pattern B, an operator copies values from the vault into ordinary cluster secrets, and pods use them the usual way. In pattern C, the pod asks for a special volume, and a storage driver fetches the secrets at start-up and mounts them as files. In pattern D, the application itself talks to the vault using a client library.

Pattern A: the agent injector

The injector uses a hook that watches pods as they are created. A pod that carries certain labels or notes is modified: an init container is added to fetch secrets before the application starts, and a sidecar container keeps them fresh afterwards. Secrets are written as files into a shared in-memory folder. The application knows nothing about Vault; it simply reads files. The cost is one or two extra containers in every pod that uses it. This pattern echoes what we saw with init containers: a helper prepares the pod before the application begins.

Strength

No application changes

The application reads ordinary files. Vault stays invisible.

Strength

Secrets stay out of the cluster database

Values live in memory-backed folders in the pod, not in cluster secrets.

Strength

Supports dynamic secrets and renewal

The sidecar renews leases and refreshes files.

Limit

Extra containers per pod

Each pod pays memory and start-up cost for the helpers.

Pattern B: operators that sync to cluster secrets

An operator watches special custom resources that describe which secrets to fetch, from where, and how often to refresh. It then creates or updates ordinary cluster secrets with the fetched values. Two well-known families exist: operators from the vault vendor, and general-purpose operators that support many secret managers behind a common interface. Pods consume the resulting cluster secrets exactly as they always have, through environment values or mounted files.

Strength

Works with any application

Anything that already reads cluster secrets keeps working unchanged.

Strength

Central and declarative

What to sync is described in files that can live in version control, without containing any secret values.

Strength

Multi-provider options

General-purpose operators speak to several secret managers with one style of definition.

Limit

Values land in the cluster database

Synced secrets are ordinary cluster secrets again, so encryption at rest and tight access rules matter.

Pattern C: the CSI driver

The secrets store CSI driver lets a pod declare a volume whose contents come from an external store. When the pod starts, the driver logs in to the vault, fetches the requested secrets and mounts them as files. Optionally it can also create a cluster secret from them. Because the fetch happens as part of mounting, a pod cannot start until its secrets are ready, which is a useful safety property.

Strength

Pod waits for its secrets

Start-up is naturally blocked until the volume can be mounted.

Strength

Provider-neutral

Providers exist for several secret managers behind the same driver.

Limit

Refresh needs care

Updating secrets in running pods depends on rotation features and on how the application rereads files.

Limit

Node-level component

The driver runs on every node, which adds something to install and secure.

Pattern D: the application talks to Vault directly

The application includes a Vault client library, logs in with its service account token, and reads what it needs. This gives the most control: it can renew leases, react to rotation instantly and request dynamic secrets exactly when needed. The price is that Vault-specific code enters every application, which teams must write, test and maintain, and which ties the application to Vault.

Everyday analogy

Think of four ways to get the keys to a delivery driver. A personal assistant hands them over at the door each morning (injector). A clerk copies the keys into the depot’s key cabinet (operator). The van itself will not unlock until a key arrives at the gate (CSI driver). The driver walks to the key room personally and signs the register (direct). All work, and each fits a different company.

!
Read this twice

This article was written without live web research. Tool names, features and defaults in this fast-moving area change often, so confirm the exact behaviour of each component in its official documentation for the version you plan to run.

8Side by Side, and Beyond Vault

A single table cannot decide for you, but it shows the shape of the differences at a glance.

QuestionAgent injectorSync operatorCSI driverDirect from the app
Application changes neededNoneNoneNoneYes, library code
Where secrets landFiles in a memory folderCluster secretsMounted files, optionally cluster secretsInside the application’s memory
Extra containers per podOne or twoNoneNoneNone
Dynamic secrets and leasesStrong supportDepends on the operatorLimited, depends on providerFull control
Refresh in running podsSidecar refreshes filesOperator updates secrets on a scheduleRotation features, application must rereadApplication decides
Secrets stored in cluster databaseNoYesOptionalNo
Multi-provider supportVault focusStrong in general-purpose operatorsStrong, through providersPer library
Best fitVault-centred platforms with dynamic secretsExisting apps and GitOps workflowsStrict start-up ordering, provider neutralitySecurity-critical apps needing fine control

Other names you will meet

Cloud

Cloud secret managers

Every major cloud offers its own managed secret store, with tight integration to that cloud’s identity system. Operators and CSI providers can read from them.

Git

Encrypted secrets in version control

Tools that encrypt secret files so they can be stored safely in Git and decrypted only inside the cluster. They solve repeatable deployments, not central rotation or audit.

Restart

Reloaders

Small tools that watch for changed secrets and restart the workloads that use them, closing the refresh gap for applications that read values only at start-up.

Identity

Workload identity systems

Systems that give each workload a cryptographic identity, reducing reliance on long-lived passwords altogether.

Secrets that are not passwords

Secrets management is not only about passwords. Vault can also act as a private certificate authority, issuing short-lived certificates so that services can prove their identity to each other and encrypt their traffic. It can offer encryption as a service, where an application sends data to be encrypted or decrypted and never holds the key itself. It can hand out temporary cloud access credentials so that no long-lived cloud keys sit in a cluster. These features show why many teams choose a full vault rather than a simple store: one policy model, one audit trail and one set of habits can cover passwords, certificates, keys and cloud access together.

Managed secret stores versus self-run Vault

A managed store removes the burden of running the vault yourself: no servers to patch, no unseal to plan, and the provider handles availability. The price is tighter ties to one provider and fewer advanced features. Running Vault yourself, or using a managed Vault offering, gives richer features such as dynamic secrets across many systems, and works the same across clouds and on your own servers, at the price of operating a critical service. Many organisations run one central Vault and connect all clusters to it, and some mix in a managed store for simple cases.

Choose a managed store when

You live in one cloud, your needs are mostly static secrets, and you want the least to operate.

Choose Vault when

You need dynamic secrets, a certificate authority, encryption as a service, portability across environments, or one policy model for everything.

Everyday analogy

Using a bank’s safe-deposit service is convenient, and the bank does the guarding. Building your own vault gives you exact control, at the price of hiring guards and maintaining the building. Most people rent, and the largest organisations build.

9Security of the Integration

A vault protects secrets only as well as the arrangement around it. This chapter covers the weak points and how to close them.

Roles

Keep roles narrow

Bind each role to specific service accounts in specific namespaces. Avoid wildcards that let any pod log in.

Policies

Least privilege paths

Give each application read access to only its own secret paths, and no write or list rights it does not need.

Tokens

Short lifetimes

Short token and lease lifetimes limit how long a stolen credential is useful.

Transport

Encrypt every connection

All traffic between pods and Vault should use encrypted, verified connections, and Vault should never be reached over plain text.

Audit

Log every request

Switch on audit devices, ship the logs to a safe place and review unusual access patterns.

Unseal

Protect the unseal keys

Use automatic unsealing through a trusted key service, or split keys among trusted people, and never store them beside the data.

The weak points people forget

Weak pointWhy it mattersWhat to do
Synced cluster secretsThey are stored again in the cluster database, encoded rather than encrypted by defaultEnable encryption at rest and tight access rules, or choose a pattern that avoids them
Anyone who can create podsA pod running as an allowed service account can fetch that account’s secretsLimit who can create pods and use those service accounts
Secrets in environment valuesThey leak into logs, crash dumps and process listingsPrefer files in memory-backed folders where possible
Long-lived static secretsA leak stays useful for monthsRotate regularly and prefer dynamic secrets
One shared role for many teamsA compromise of one team exposes the othersCreate separate roles and policies per application
Wide administrative tokensThey can read or change everythingKeep them offline or heavily restricted, and use them rarely
Unmonitored audit logsAttacks pass unseenAlert on failed logins and unusual reads

The secret zero problem

Every secret system faces a puzzle: to fetch secrets you need an identity, and an identity looks a lot like a secret. If a pod needs a password to talk to Vault, where does that password come from? Kubernetes’ built-in identity solves it neatly. The cluster already knows each pod and issues a signed, short-lived token automatically, so no human-typed password is needed for the first step. Vault trusts the cluster’s answer about who the pod is. The chain of trust therefore rests on the cluster’s own identity system, and protecting the cluster’s service accounts and API access becomes essential.

Everyday analogy

To enter a secure building you need a pass. To get a pass you need to show identification. The neat solution is when your employer, whom the security desk already trusts, vouches for you directly. The cluster is that employer. The trouble arises only when the employer’s own records can be tampered with.

Multi-tenancy and separation between teams

When many teams share one vault, separation becomes a design question. Vault offers ways to divide it into isolated areas so that one team’s administrators cannot see or change another’s secrets, and different editions provide different tools for this. At a minimum, use clear path prefixes per team and environment with policies that never cross them. Give each team’s administrators rights only in their own area. Keep production and non-production apart, ideally with separate vaults or separate isolated areas and separate administrators, so that a mistake in testing can never touch a production secret.

Separate audit trails per team are valuable too. When a security review asks who touched a payment credential, the answer should come from a log that is easy to filter and hard to alter.

Practical hardening checklist

On the Vault side

Encrypted connections only. Audit devices on. Narrow roles and policies. Short token lifetimes. Automatic unseal with protected keys. Regular backups of Vault’s storage and a tested restore. Limited administrative access with strong authentication.

On the cluster side

Encryption at rest for the cluster database. Tight rules on who can create pods and read secrets. Dedicated service accounts per application. Network policies restricting which pods can reach Vault. Pinned, scanned images for helper components.

On the application side

Never log secret values. Prefer files over environment values. Handle rotation gracefully. Fail closed when secrets are missing instead of falling back to a default password.

!
Read this twice

A vault does not remove the need to protect the cluster. If an attacker can run a pod as a trusted service account, Vault will faithfully hand that pod the secrets it is allowed to read. Protect the identity chain as carefully as the vault itself.

10Choosing the Right Approach

There is no single best pattern, only the best fit for your platform, your applications and your people. A few questions get you most of the way.

flowchart TD
  A["How should my pods receive secrets?"] --> B{"Can I change the application code?"}
  B -->|"Yes, and I want fine control"| C["Application talks to the vault directly"]
  B -->|"No, or I prefer not to"| D{"Do I need dynamic secrets and lease renewal?"}
  D -->|"Yes"| E["Agent injector"]
  D -->|"No, mostly static values"| F{"Must the pod refuse to start without its secrets?"}
  F -->|"Yes"| G["CSI driver"]
  F -->|"No, and my apps already read cluster secrets"| H["Sync operator"]
    
Figure 6. A simple decision path for choosing an integration pattern.

Reading Figure 6

Begin with the top question: can you change the application? If yes, and you want the finest control, letting the application talk to the vault directly is an option, at the cost of library code. If you prefer not to touch the application, ask whether you need dynamic secrets and lease renewal. If yes, the agent injector supports them best. If your secrets are mostly static, ask whether the pod must refuse to start without them. If so, the CSI driver gives that property naturally. If not, and your applications already read cluster secrets, the sync operator is the least disruptive choice.

The questions behind the chart

Ask

What kinds of secrets?

Dynamic database logins and certificates favour the injector or direct access. Static keys are fine with operators or drivers.

Ask

Where may secrets land?

If secrets must never appear in the cluster database, avoid sync operators or protect them heavily.

Ask

How do we deploy?

Teams using version-controlled deployments like the declarative style of operators.

Ask

What runs in each pod?

Small, numerous pods feel the cost of helper containers more than large ones.

Ask

How often do secrets change?

Frequent change needs a plan for refresh: sidecars, reloaders or applications that reread files.

Ask

Which stores do we use?

A mix of cloud stores and Vault favours provider-neutral operators or drivers.

A team with many legacy applications

They cannot change code and already read cluster secrets. A sync operator connects them to the vault with almost no disruption, with encryption at rest switched on.

A platform team focused on dynamic database credentials

The injector gives each pod a unique, short-lived login and keeps leases renewed, with no application changes.

A regulated service with strict start-up rules

The CSI driver ensures a pod cannot start until its secrets are mounted, and audit trails show each fetch.

A security-critical application

The application uses a client library directly, holds secrets only in memory and reacts instantly to rotation.

Everyday analogy

Choosing a pattern is like choosing how to get keys to staff. A personal handover suits a small careful team. A key cabinet suits a busy depot. A door that will not open without a key suits a strict workshop. Match the method to the people, the building and the risk.

i
Tip

Many organisations use more than one pattern. It is fine to use an operator for simple static values and the injector for dynamic database credentials, as long as the platform team documents which is used when.

11Performance and Availability

Once every pod depends on the vault, the vault becomes part of your critical path. Plan for its speed and its failures.

Where the time goes

Cost

Login at start-up

Each pod logs in and fetches secrets before it can work, adding seconds to start-up.

Cost

Cluster identity check

Each login triggers a check against the cluster’s API. Mass starts create a burst of such checks.

Cost

Dynamic secret creation

Creating a temporary database user is slower than reading a stored value, and loads the database.

Cost

Helper containers

Injector helpers use memory and processor in every pod.

Cost

Audit logging

Writing detailed records costs a little on every request, and a stalled audit log can block requests by design.

Cost

Renewal traffic

Thousands of pods renewing leases produce steady background traffic to Vault.

Ways to go faster and stay safer

Use caching where the pattern allows it, so that repeated reads within a short time do not each hit the vault. Choose sensible lease lengths: longer leases mean fewer renewals but weaker safety. Spread mass restarts so that hundreds of pods do not log in at once. Run several Vault servers for availability and consider read replicas or performance standby servers where your edition provides them. Scale the helpers’ resource requests to realistic values, and keep secret sizes small.

ConcernSymptomTypical remedy
Login storm after a big restartSlow logins, timeouts, pods stuck at start-upStagger restarts, add capacity, use caching
Vault server unavailableNew pods cannot startRun several servers across zones, test failover
Sealed after restartEvery request refusedAutomatic unseal with a trusted key service
Short leases on many podsConstant renewal loadBalance lease length against safety
Stalled audit deviceVault stops answeringUse several audit destinations and monitor them
Cluster identity checks slowLogins delayed under loadCheck API server capacity and login rates

Many clusters, one vault

Large organisations often connect dozens of clusters to one central Vault. Each cluster gets its own login path, so that a service account named “orders” in one cluster is not confused with an identically named account in another. The vault trusts each cluster separately, and roles are defined per cluster. This keeps clusters isolated from each other while giving the security team one place to see and control access. The price is that the vault serves a much larger population of pods, so capacity planning, high availability and careful rate management matter more.

Latency also matters. A pod that must cross a slow or distant network to reach the vault will start slowly, and the login and fetch steps are sensitive to delay. Placing the vault close to the clusters that use it, or using replicated read capacity near each region where your edition allows it, keeps start-up times reasonable.

Designing for a vault outage

Assume the vault will be unavailable sometimes: for upgrades, for network problems, for a bad day. Decide what your applications do in that moment. Applications that already hold their secrets should keep running, so use leases and token lifetimes long enough to ride out short outages. New pods that cannot fetch secrets should wait with clear messages and retry, instead of starting with defaults. Practise the failure in a test environment, including a full loss of a zone, and keep a documented recovery procedure with restore tests of Vault’s backups.

Everyday analogy

Think of the main key room in a large hotel. If the desk clerk steps out for five minutes, guests already in their rooms are fine, but arrivals must wait. A good hotel keeps a second clerk on shift, tests the fire drill, and never leaves master keys in an unlocked drawer as a shortcut.

!
Watch out

Never solve an outage problem by hard-coding fallback passwords into applications. A fallback secret defeats the whole purpose, and is usually discovered by attackers first.

12Advantages, Disadvantages and Trade-offs

Every choice buys something and costs something. Here is an honest ledger for external secrets management.

Advantage

Central control

One place to create, rotate, revoke and review secrets for many clusters and applications.

Advantage

Fine-grained access

Policies limit each application to exactly the secrets it needs.

Advantage

Audit and accountability

Every request is recorded, supporting reviews and investigations.

Advantage

Dynamic, short-lived secrets

Credentials that expire on their own shrink the impact of leaks.

Disadvantage

A new critical service

The vault must be highly available, backed up and monitored, since applications now depend on it.

Disadvantage

More moving parts

Roles, policies, helpers and operators each need designing and maintaining.

Disadvantage

Start-up dependency

Pods may not start when the vault is unreachable or sealed.

Disadvantage

Learning curve

Teams must learn the vault’s concepts and their chosen integration’s quirks.

Trade-offs in plain words

The first trade-off is security against operational burden. A central vault raises security and visibility, and at the same time it becomes something you must run well. For a small team with a handful of static secrets, the built-in objects with encryption at rest and tight access rules may be enough, and the burden of a vault may not be worth it yet.

The second is transparency against control. Injectors and operators hide the vault from applications, which is easy for developers, but they limit fine control over renewal and rotation. Direct access gives control, and puts vault code into every application.

The third is safety against convenience of start-up. Making pods wait for their secrets is safe, and can slow or block starts during outages. Letting them start and fail later is faster, and creates confusing partial failures.

The fourth is freshness against stability. Short leases and frequent refresh limit the life of leaked secrets but create more traffic and more chances for something to go wrong. Longer lifetimes are calmer and weaker. Pick lifetimes that match how sensitive each secret is.

Everyday analogy

A high-security building with guards, logbooks and badges is safer than an open door, and it costs money and adds queues at the entrance. A small shop with three staff may reasonably use a simple lock. The right choice depends on what you protect and who might want it.

13Monitoring and Troubleshooting

When a secret does not arrive, the cause lies in one of three stages: identity, authorisation or delivery. A calm routine finds it quickly.

Symptoms and where to look

What you seeLikely meaningWhere to look first
Login refused, role not found or not allowedService account or namespace does not match any roleRole bindings against the pod’s service account and namespace
Permission denied when reading a secretThe policy does not include that path or actionPolicy paths, capabilities, the secret’s real path
Token expired errorsRenewal failed or token lifetime is too shortHelper logs, lifetimes, connectivity to the vault
Vault unreachable or sealedNetwork problem, outage or unseal failureVault status, network policies, unseal mechanism
Pod stuck at init with helper waitingHelper cannot log in or fetchHelper logs, role and policy, network path
No helper containers were addedThe injection hook did not act on the podLabels or notes on the pod, hook health, namespace settings
Application uses an old valueValue rotated but application did not reread itRefresh settings, restart mechanism, reloaders
Synced secret missing or staleOperator cannot read the vault or refresh failedOperator status and events, refresh interval, store credentials

A calm troubleshooting routine

First, identify the stage. Did the pod fail to log in, fail to read, or fail to receive? Second, check the pod: which service account does it use, and in which namespace? Third, compare with the role: does a role name exactly that account and namespace? Fourth, compare the policy with the exact path the application requests, remembering that engines may add path prefixes that trip people up. Fifth, read the helper’s or operator’s logs, which usually quote the vault’s reply. Sixth, check Vault’s audit log for the failed request; it shows precisely which identity asked for which path and why it was refused. Seventh, check the vault’s own health: sealed, overloaded or unreachable.

Layer 1

Pod identity

Service account name, namespace and token validity.

Layer 2

Role

Whether a role binds that account and namespace, and which policies it attaches.

Layer 3

Policy

Whether the requested path and action are allowed.

Layer 4

Delivery

Helper, operator or driver health and logs.

Layer 5

Network

Whether the pod or operator can reach the vault, over verified encrypted connections.

Layer 6

Vault health

Sealed state, capacity, storage and audit devices.

Testing the integration before you trust it

A short experiment beats a long debate. In a test cluster, create a test service account, a narrow role and a policy for one test secret. Start a pod with that account and confirm it can read the secret. Then start a second pod with a different service account and confirm it is refused, and check that the refusal appears in the audit log with the right identity and path. Change the secret and watch how long the running pod takes to see the new value. Stop the vault, or block its network, and observe what happens to a running pod and to a new pod. Finally, revoke a lease and confirm that the credential really stops working. Keep the results in your team’s notes, together with the versions used, and rerun the same experiment after every upgrade. Ten minutes of testing here saves hours of guessing during a real incident.

What to monitor all the time

Track Vault’s availability and sealed state, request rates and latency, failed logins, permission denials, lease counts, token counts, storage health and audit device health. Alert on a sealed vault immediately, on sudden spikes of denials, which may mean an attack or a broken deployment, and on secrets close to expiry without renewal. On the cluster side, watch helper container restarts, operator sync errors and pods waiting on secrets for longer than a few minutes.

A worked example

A new service’s pods stay stuck at start-up, and the helper logs say login was refused. The team checks the pod: its service account is named “orders-api” in the namespace “shop”. The Vault role names “orders-api” but lists the namespace “shop-test”. The difference is one word. Correcting the role’s namespace lets the pods log in, and the audit log confirms the successful reads. Following the three-stage routine turned a scary security error into a five-minute fix.

Everyday analogy

When a guest is refused at a hotel, the desk asks in order: is there a booking under that name, does it cover this room, is the key coded correctly, is the door jammed? Guessing at the door before checking the booking wastes everyone’s time.

i
Tip

The audit log is your best friend in troubleshooting. It records the exact identity and path of every denied request, which usually reveals the mismatch immediately. Make sure people who troubleshoot can read it safely.

14Design Patterns and Anti-patterns

A pattern is a proven way of solving a repeated problem. An anti-pattern is a tempting habit that keeps causing pain.

Patterns worth adopting

Pattern

One role per application

Each application gets its own service account, role and policy, so a compromise stays contained.

Pattern

Dynamic secrets where possible

Let the vault create unique, short-lived logins for databases and cloud access instead of sharing one long-lived password.

Pattern

Declarative definitions in version control

Keep descriptions of what to fetch, never the values, in your repository and deploy them like any other configuration.

Pattern

Paths that mirror your organisation

Organise secret paths by team, environment and application, so that policies read like sentences.

Pattern

Rotation with a reload plan

Pair every rotation schedule with a way for running applications to pick up the new value.

Pattern

Separate vaults or namespaces per environment

Keep production secrets isolated from testing, with separate policies and administrators.

Anti-patterns to avoid

Anti-pattern

One shared role for everything

Every pod gets every secret, and one compromise exposes them all.

Anti-pattern

Secrets copied into cluster objects and forgotten

Synced copies with no encryption at rest and broad access rules undo the vault’s benefits.

Anti-pattern

Root or administrator tokens in applications

A powerful token in a pod turns any bug into a total breach.

Anti-pattern

Fallback default passwords

Applications that start with a hard-coded password when the vault is unreachable.

Anti-pattern

Rotation without reload

Changing values that running applications never reread, causing outages at the next restart.

Anti-pattern

Secrets in logs and environment dumps

Printing or exposing values in places that many people can read.

DECISION 01 · How should a platform deliver database credentials to pods? Accepted
Context

A platform serves forty applications that connect to shared databases. Today the applications use a few long-lived passwords stored as cluster secrets. Auditors want per-application accountability and regular rotation.

Options considered

Keep static passwords and rotate them by hand. Sync static passwords from the vault with an operator. Use the vault’s dynamic database secrets delivered by an agent injector.

Decision

Use dynamic database secrets delivered by the injector, with one role per application and short leases. Keep the operator only for third-party API keys that cannot be made dynamic.

Consequences

Each pod receives a unique, expiring login and the audit log shows exactly which application used which credentials. The platform team must run the vault with high availability and teach teams how the injector behaves. Helper containers add a little memory to each pod.

Everyday analogy

A company where every employee shares one master key is cheap to run and impossible to audit. A company that issues each person a personal, expiring badge knows exactly who entered where, and stops a lost badge from causing lasting harm. Design your secrets the way the second company designs doors.

15Best Practices and Common Mistakes

This chapter gathers the advice into checklists you can keep beside your desk.

Best practices

Identity and access

One service account per application. Narrow roles bound to specific accounts and namespaces. Least-privilege policies on specific paths. Short token lifetimes. Strong protection of who can create pods and read cluster secrets.

Secret hygiene

Prefer dynamic secrets. Rotate static ones on a schedule. Never commit values to version control. Prefer files in memory-backed folders over environment values. Never log secret values.

Reliability

Run Vault with several servers across zones. Automate unsealing. Back up storage and test restores. Decide and test what applications do during a vault outage. Stagger mass restarts.

Operations

Enable audit logging and monitor it. Alert on sealed state, failed logins and lease trouble. Document roles, paths and the chosen integration pattern. Rehearse rotation and recovery in a test environment.

Common mistakes

MistakeWhy it hurtsBetter approach
Using wildcards in role bindingsAny pod can log in and receive secretsName exact accounts and namespaces
Syncing secrets without encryption at restThe cluster database again holds readable secretsEnable encryption at rest and restrict access
No plan for vault outagesPods cannot start during maintenanceHigh availability, tested failure behaviour, sensible lease lengths
Rotating without reloadingApplications hold old values and fail laterSidecars, reloaders or applications that reread files
Very long-lived tokensStolen tokens stay usefulShort lifetimes with renewal
Skipping audit logsAttacks and mistakes go unseenEnable, ship and review them
Storing unseal keys beside the dataDefeats the purpose of sealingUse a trusted key service or split keys among people
Mixing environments in one pathTesting mistakes touch production secretsSeparate paths, policies and, ideally, vaults
Debugging by printing secretsValues leak into logsDebug with the audit log and status messages

A platform guide for your teams

If you run a platform for other teams, write a one-page guide and keep it current. It should say which integration pattern is standard, how to request a role and a secret path, how rotation works, what to do during a vault outage, and who to contact. Include a short decision chart like the one in Chapter 10 and a few sentences on the most common traps. Developers who can read a page like this rarely need to ask for help, and the platform team spends far less time on access tickets.

Make the safe path the easy path. Provide templates that already contain a narrow role, a sensible lease length and a correct pattern, so that teams start secure by default and adjust from there.

i
Review habit

Whenever you review a secrets change, ask three things: who can read it, how long does it live, and how would we know if it were misused?

16Real-World Usage Stories

These generic stories, based on common patterns rather than any specific company, show how the ideas play out.

The password in the repository

A team discovered that a production database password had lived in their version control history for three years, copied into every developer’s clone. Rotating it meant finding every place it was used. After moving to a vault with dynamic database credentials, the team could rotate at will, and each application had its own login. The old password was finally retired, and the audit log answered questions that used to have no answer.

The role with one wrong word

A new service could not start because its pods were refused at login. The role listed a test namespace rather than the production one. The audit log made the mismatch obvious in minutes. The team added a review step for role definitions and a template that fills in the namespace automatically.

The rotation that broke Monday

A team rotated a static password on Friday evening. Applications that read it only at start-up carried on happily until a routine restart on Monday, when they picked up the new value without trouble. One legacy application, however, had cached the old value and crashed when its connection dropped. The team introduced a reloader for workloads that read secrets at start-up, and a rotation checklist that includes a restart plan.

The vault that was sealed on a holiday

After a routine restart, an unseal step required a person, and nobody was watching on a public holiday. New pods could not start until someone came online. The team moved to automatic unsealing through a cloud key service, added an alert for sealed state, and wrote a short runbook.

The synced secret that was too visible

A team used an operator to sync secrets and later found that many engineers could read them from the cluster because access rules were broad. They tightened access, turned on encryption at rest, and moved their most sensitive credentials to a pattern that never stored values in the cluster database.

Three worked scenarios: thinking like a designer

Scenario one: a small start-up with five services

The team has a handful of static secrets and no dedicated operations staff. A managed secret store from their cloud, with an operator that syncs values into the cluster and encryption at rest switched on, gives them audit and rotation with little to operate. A self-run vault would be more than they can look after today.

Scenario two: a bank-style platform with many databases

Many teams, strict audit requirements and dozens of databases. Vault with dynamic database secrets, one role per application and delivery by the agent injector fits well. The platform team runs Vault across zones with automatic unseal, audit devices shipping to a protected store and clear runbooks.

Scenario three: a legacy application that cannot change

An old application reads its password from an environment value and cannot be modified. A sync operator creates a cluster secret from the vault, with encryption at rest and tight access rules. A reloader restarts the application when the value changes. It is not the ideal design, and it brings the application under central management without touching its code.

A short mental checklist for a new application

Before connecting a new application to the vault, pause and walk through a short list. State which secrets it needs and whether each could be dynamic. Give it its own service account. Write a role that names that account and namespace only. Write a policy for exactly the paths it needs. Choose the delivery pattern and decide where the values will land. Decide how rotation will reach running instances. Decide what the application does if the vault is unavailable. Check that audit logs will show its access. Ten minutes on this list prevents most of the problems described in this article.

The best secrets system is the one where nobody ever sees a password, and everybody can see who used it.

17Frequently Asked Questions

Quick answers to the questions beginners ask most often.

Q1Are Kubernetes Secrets encrypted?
By default they are stored encoded, not encrypted, in the cluster database. Encryption at rest can be enabled, and access is controlled by roles, but the built-in object lacks central rotation and detailed audit trails.
Q2Why not just encrypt the cluster database and stop there?
Encryption at rest protects the disk and backups. It does not limit who inside the cluster may read a secret, does not rotate values and does not give a per-read audit trail. Many teams do both: encrypt the database and use a vault.
Q3What is Vault’s Kubernetes auth method?
It lets pods log in to Vault using their service account token. Vault checks the token with the cluster and maps the service account and namespace to a role with policies.
Q4What is the difference between static and dynamic secrets?
A static secret is a stored value that stays until changed. A dynamic secret is created on demand, has a lease and is deleted when the lease ends.
Q5Which integration pattern should I start with?
If you cannot change applications and mostly have static values, a sync operator is the gentlest start. If you want dynamic database credentials without code changes, the agent injector fits. Use Chapter 10’s chart for the details.
Q6Does using a sync operator defeat the purpose of a vault?
Not entirely. You still get central management, rotation and audit at the vault, but the values also live as cluster secrets, so you must protect them with encryption at rest and tight access rules.
Q7What happens to running pods if Vault goes down?
Pods that already hold their secrets usually keep working until leases or tokens expire. New pods cannot fetch secrets and will wait or fail, depending on the pattern. Plan lifetimes and failover accordingly.
Q8What is a sealed vault?
Vault starts with its data locked. It must be unsealed, manually or automatically, before it can answer requests. Sealing protects data if storage is stolen.
Q9How do applications learn about rotated secrets?
It depends on the pattern. Sidecars refresh files, operators update cluster secrets, and applications must reread them. Reloader tools can restart workloads when values change.
Q10What is the secret zero problem?
It is the puzzle of how the first credential is delivered securely. In a cluster, the platform’s own service account tokens solve it, because the cluster already vouches for each pod.
Q11Should Vault run inside the cluster it protects?
It can, but running it in a separate platform cluster or on dedicated machines avoids circular dependencies. Choose based on your team’s operational capacity.
Q12Are environment values safe for secrets?
They are riskier than files, because they can leak into logs, crash dumps and process listings. Prefer files in memory-backed folders where you can.
Q13Can I use a cloud secret manager instead of Vault?
Yes. Operators and drivers can read from cloud stores with the same overall design. Choose Vault when you need its richer features or portability across environments.
Q14How do I keep secrets out of version control but keep deployments repeatable?
Keep only descriptions of which secrets to fetch in version control, never the values. The operator, injector or driver fetches values at run time.
Q15Who can read secrets delivered by the injector?
Anyone who can run commands inside that pod, or read its memory-backed folder, can read them. Limit who can open shells in production pods.
Q16What should I monitor first?
Start with Vault’s availability and sealed state, failed logins, permission denials and helper or operator errors in the cluster. These reveal most real problems early.
Q17Is a vault overkill for a small team?
Sometimes. A small team with few static secrets may do well with built-in secrets, encryption at rest and tight access, or a managed store. Adopt a full vault when auditing, rotation or dynamic secrets become real needs.
Q18Does this replace network security and access control?
No. It is one layer. Combine it with network policies, least-privilege access, image scanning and monitoring.

This post was written without live web research. Please verify version-sensitive details, such as feature names, defaults and supported providers, against the official documentation of each tool you plan to use.

18Summary and Key Takeaways

Let us close the loop, returning to the hotel key room from the start of this article.

Just as a hotel is safer with a guarded key room, a logbook and keys that expire on their own, a cluster is safer when its secrets live in a proper vault outside the cluster. Pods prove who they are, receive only what a policy allows, and every access leaves a trail. Dynamic secrets limit the harm of any leak by expiring on their own.

You met the problem of sticky-note secrets, the building blocks of engines, auth methods, roles and policies, and the architecture that connects pods to Vault. You followed a secret’s life, compared the four integration patterns, learned about security, performance, trade-offs and troubleshooting, and saw the mistakes that trap teams most often.

Version drift and things to verify

This area of Kubernetes changes quickly. Tool names, installation methods, supported providers, defaults and even the recommended patterns have shifted over the years, and several projects have merged, split or been renamed. Because this article was written without live web research, treat version-specific statements as a starting point. Before relying on a feature in production, read the official documentation for the exact versions you will run, try the behaviour in a test cluster, and record the versions in your team’s notes so upgrades prompt a re-check. Also verify licence and edition differences for Vault features, since some capabilities depend on the edition you use.

A small glossary to keep nearby

Term

Secret

A small piece of sensitive data an application needs, such as a password or key.

Term

Vault

A dedicated system that stores secrets, controls access and records every request.

Term

Service account

The identity a pod uses inside the cluster, with a signed token.

Term

Role

A mapping from a cluster identity to the vault policies it receives.

Term

Policy

Rules listing which secret paths may be read or written.

Term

Lease

A time limit on a secret, after which it stops working unless renewed.

Term

Dynamic secret

A credential created on demand and deleted automatically when its lease ends.

Term

Sealed

The locked state of Vault, in which it cannot read its own data or answer requests.

Key takeaways

Takeaway 1

Built-in secrets are a start, not an end

They are encoded, broadly readable and hard to rotate or audit.

Takeaway 2

Identity first

Pods prove who they are with cluster-issued tokens, and narrow roles turn identity into limited access.

Takeaway 3

Prefer short-lived secrets

Dynamic secrets and short leases shrink the damage of a leak.

Takeaway 4

Pick a pattern that fits

Injector, operator, CSI driver or direct access, chosen by your applications, secrets and people.

Takeaway 5

Plan for outages and rotation

Test what happens when the vault is down and when values change.

Takeaway 6

Troubleshoot in three stages

Identity, authorisation, delivery, with the audit log as your guide.

i
Your next step

Pick one application in your cluster. Find where its secrets live today, who can read them and how long they have been the same. That small review shows you exactly where a vault would help most.