DevOps interview questions: secrets & config management
Reviewed by Mark Dickie · Last updated
5 questions on this page you can answer and see marked on the spot. Go to the first one
Secret management in DevOps is the practice of storing, distributing, and rotating sensitive configuration data such as API keys, passwords, and certificates without exposing them in source code, images, or logs. For interviews, you should know the common tools (HashiCorp Vault, Kubernetes Secrets, AWS Secrets Manager, Sealed Secrets), the difference between encryption at rest and encryption in transit, and the rotation and access-control patterns each tool supports. Expect questions on how secrets differ from plain config, how to inject secrets into containers at runtime, and how to audit who accessed what.
Most teams fail secret-management questions by conflating storing a secret with protecting it. A base64-encoded Kubernetes Secret is not encrypted by default; it only becomes protected when you enable encryption at rest via a KMS provider or an external secrets backend.
| Area | What to study | Common interview angle |
|---|---|---|
| Kubernetes Secrets | base64 encoding vs encryption, External Secrets Operator, Sealed Secrets | "Walk me through how a Secret gets mounted into a Pod and where the plaintext is visible." |
| HashiCorp Vault | dynamic secrets, lease renewal, policies, namespaces | "How would you issue a short-lived database credential to a Pod?" |
| Cloud-native stores | AWS Secrets Manager / Parameter Store, GCP Secret Manager, Azure Key Vault | "Compare Parameter Store and Secrets Manager — when would you pay for the latter?" |
| Secret rotation | sidecar injectors, cron-based rotation, workload identity | "Design rotation for a shared API key used by 50 services." |
| CI/CD pipelines | masked variables, OIDC federation, ephemeral tokens | "How do you pass secrets to a pipeline without storing them in the repo?" |
What does a DevOps secret-management interview test?
Interviewers are checking whether you can reason about the full lifecycle of a secret, not just name a tool. The strongest answers cover creation, distribution, consumption, rotation, and revocation.
- Creation and storage — where the secret lives (Vault, KMS, Secrets Manager), who can write to it, and whether it is static or dynamically generated.
- Distribution — how the secret reaches the workload: mounted volume, environment variable injected at runtime, sidecar agent, or a CSI driver.
- Access control — policies, roles, service accounts, and identity-based auth that tie secret access to a specific workload rather than a shared token.
- Rotation and expiry — short-lived vs long-lived credentials, automatic rotation, and what happens when a lease expires mid-request.
- Auditing and incident response — access logs, break-glass procedures, and how to revoke a compromised secret across every consumer.
How do you keep secrets out of Git and images?
The short answer: never commit them in the first place, and make it structurally hard to do so. Use pre-commit hooks that scan for high-entropy strings, store real values in a managed backend, and inject at deploy or runtime. Sealed Secrets and the External Secrets Operator both let a team keep a safe, encrypted representation in Git while the plaintext stays in the cluster's secret store. During the interview, name a concrete failure mode — a secret leaked through a Docker layer or a forwarded environment variable — and the control that prevents it.
Key facts
- Tarmac has 14 DevOps interview questions on this topic, 10 of them on this page, at difficulty 1–5 of 5.
- Tarmac tracked 2,209 job postings asking for DevOps in September 2026.
- Roles asking for DevOps advertise a median base salary of £80,000, across 811 job postings as of September 2026.
- Tarmac last reviewed these DevOps interview questions on 21 September 2026.
At a glance
| Questions | 10 shown · 14 in the bank |
|---|---|
| Difficulty | 1–5 of 5 |
| Formats | Multiple choice, Multiple answer, True / false, Flashcard, Short answer, Ordering, Design exercise, Fill in the blank |
What you'll review
- secret management
Practice questions
Try one before you open the answer. Pick an option and press Check; it's marked on the spot.
Which of the following is a dedicated secret management tool used to store, control access to, and dynamically generate secrets such as API keys, passwords, and certificates?#
Options
Show answer
HashiCorp Vault is a dedicated secret management tool for securely storing, controlling access to, and dynamically generating secrets like API keys, passwords, and certificates. Jenkins (CI/CD), Prometheus (monitoring), and NGINX (web server/reverse proxy) serve entirely different purposes and are not designed for secret management.
HashiCorp Vault is a purpose-built secret management tool that provides encrypted storage, access control, dynamic secret generation, and audit logging for sensitive data. Jenkins is a CI/CD server, Prometheus is a monitoring system, and NGINX is a web server/reverse proxy—none are designed for secret management.
Which of the following are recommended practices for handling application secrets such as database passwords and API tokens? Select all that apply.#
Options
Pick every one that applies.
Show answer
Good secret management keeps credentials out of source code and Git history. Teams store secrets in a dedicated secrets manager and inject them at runtime, rotate them regularly and after any suspected exposure, and grant read access only to the workloads that need each secret.
The recommended practices are storing secrets in a dedicated secrets manager and injecting them at runtime, rotating them regularly and after suspected exposure, and scoping read access to the workloads that need each secret (least privilege). Hard-coding secrets in source code and committing a .env file to Git, even to a private repository, are wrong because anyone with repository access, and every past clone or history copy, gets the credential, and removing it from history does not make it safe to reuse.
Your team deploys a microservice to Kubernetes and needs to give it a database password at runtime. Which approach correctly keeps the secret out of version control and out of the container image, while still making it available to the running pod?#
Options
Show answer
The correct approach is to store the database password in a managed secrets manager such as AWS Secrets Manager or HashiCorp Vault and inject it into the pod at runtime via short-lived credentials, environment variables, or mounted volumes. This keeps the secret out of both version control and the container image. Base64-encoded Kubernetes Secrets are not encryption, private Git repos still leak, and baking secrets into an image persists them in an image layer.
A managed secrets manager stores the credential outside both the image and the repo; the pod fetches it (or receives it via a sidecar/init container or CSI driver) at runtime, so the secret never lives in the image layer or Git history. Base64 encoding is reversible and provides no encryption. Committing secrets to a private Git repo still risks leakage through logs, forks, and history even with branch protection. Baking secrets into the image via environment variables persists them in the image layer, which is discoverable by anyone who can pull the image.
True or false: if an API key was committed and pushed to a shared Git repository, and a later commit removes the key from the files, the key no longer needs to be rotated because it is no longer in the repository.#
Options
Show answer
The statement is false. A later commit that removes the key from the working files does not erase it from Git history, so the key remains visible in past commits and in every existing clone or fetch that already contains it. The key must still be treated as compromised: revoke it, rotate it, and optionally purge it from history.
The statement is false. Git retains every past commit, so the key still exists in the repository history and in any clone or fetch that already contains it. Anyone who pulled the repository before the removal can still read the key from prior commits. Because the secret must be treated as compromised, removing it from the latest commit alone is not sufficient — the correct response is to revoke and rotate the key, and optionally rewrite history to purge it.
In secret management, what is secret rotation, and why is it preferred over relying on a single long-lived credential that is never changed?#
Show answer
Secret rotation is the practice of periodically (or on demand) replacing a secret, such as a database password, API key, or certificate, with a new value and retiring the old one. Rotation limits the window of exposure: if a credential leaks, it becomes useless after the next rotation, and rotation forces systems to fetch secrets dynamically rather than hard-coding them. Long-lived static credentials that never change mean a leak stays exploitable indefinitely and is hard to detect or revoke safely.
Rotation bounds how long a leaked credential remains valid and makes revocation a routine operation rather than an emergency. A strong answer names periodic or on-demand replacement of the secret, the reduced exposure window after a leak, and the need for consumers to retrieve secrets dynamically (not baked into images or config) so rotation does not cause outages.
Name the main anti-patterns in handling application secrets (API keys, DB passwords) and what a sound secret-management approach does instead.#
Show answer
The cardinal anti-pattern is committing secrets into source control — even in a private repo they live forever in git history and leak through forks, clones, and CI logs. Related anti-patterns: hardcoding secrets in the application image so every copy of the artifact carries them, baking them into Dockerfiles or build args, printing them to logs, sharing one static credential across all environments, and never rotating them. A sound approach keeps secrets out of code and out of the artifact entirely. They live in a dedicated secret store or vault (or the cloud provider's secret manager), are injected at deploy/runtime via environment variables or mounted files, and are scoped per environment with least-privilege access controls and audit logging. Crucially, secrets should be rotatable — short-lived or dynamically issued credentials limit the damage of a leak — and a leaked secret must be revoked and rotated, not just deleted from the latest commit, because the history still holds it.
Interviewers probe secret hygiene because the failure modes are common and costly. The headline anti-pattern is committing secrets to version control: git history is permanent, so a secret that ever touched a commit is exposed via every clone, fork, and the reflog even after you 'delete' it — which is why a leaked secret must be revoked and rotated, not merely removed from HEAD. Adjacent anti-patterns are hardcoding secrets into the application image or build args (every artifact copy now carries them), logging them, and reusing one un-rotated static credential everywhere. The sound model: keep secrets out of code and out of the build artifact, store them in a dedicated vault or cloud secret manager, inject them at deploy/runtime through environment variables or mounted files, scope them per environment with least-privilege access and an audit trail, and make them rotatable — ideally short-lived or dynamically issued so a leak has a small blast radius. A strong answer pairs the 'never in git/never in the image' rule with vault + runtime injection + rotation/revocation.
A service reads its PostgreSQL password from a secret store. You need to rotate the database password with zero downtime. Put these steps in the correct order, first to last.#
Put these in order
Show answer
Zero-downtime database password rotation starts by creating a second valid credential in the database, then saving it to the secret store as the new version. Services are rolled out to read that version, and usage of the old credential is checked. Only after that is the old credential revoked, so no running instance is cut off mid-rotation.
Zero-downtime rotation depends on overlapping validity. The new credential must exist in the database before it can be published, so creating it comes first. It must be written to the secret store before instances can be rolled out to read it. Only after instances have switched is it safe to check that the old credential is no longer in use, and revoking it comes last. Revoking earlier would break any instance still holding the old password, causing an outage.
You are the platform lead for a multi-tenant SaaS company running 40+ microservices across three Kubernetes clusters (two on EKS, one on GCP GKE). Today, every service reads secrets from Kubernetes Secret objects populated manually via CI/CD, database credentials are long-lived static passwords rotated quarterly by a DBA ticket, and several services still have API keys committed in Helm values files.#
Show answer
Architecture Overview
Secret Store: Deploy HashiCorp Vault in a dedicated, highly-available cluster (Raft storage, 3-5 nodes) not co-located with any application cluster. Vault is the single source of truth for all secrets. Each application cluster runs the Vault Agent Injector (admission webhook) or the Secrets Store CSI Driver with the Vault provider.
Why not rely on native Kubernetes Secrets: Native K8s Secrets are merely base64-encoded, not encrypted — anyone with read access to the Secret API (or the kubelet on the node) sees plaintext. Enabling EncryptionConfiguration encrypts data at rest in etcd, but it does not prevent the API server or an authorized client from decrypting and reading the secret at runtime; it only protects the raw etcd snapshot or backup. Therefore this design minimizes secrets stored in etcd by delivering them directly from Vault to the pod's memory at runtime and eliminating standalone K8s Secret objects entirely during the migration. EncryptionConfiguration is enabled on all clusters as defense-in-depth, but the architecture does not depend on it.
Authentication Path (Pod → Vault): Each pod runs under a dedicated Kubernetes ServiceAccount. Vault's Kubernetes auth method is configured per cluster with a bound ServiceAccount name and namespace, so a pod's ServiceAccount JWT token authenticates it to Vault and maps to a specific Vault policy. On EKS we additionally use IRSA (IAM Roles for Service Accounts) so the Vault pods themselves authenticate via AWS IAM; on GKE we use Workload Identity. No human token is ever used by applications.
Secret Delivery — Sidecar Agent Injector:
We use the Vault Agent Injector admission webhook. When a pod is annotated with vault.hashicorp.com/agent-inject: "true" and path annotations for each secret, the injector mutates the pod spec to add a Vault Agent sidecar. The sidecar authenticates using the pod's ServiceAccount token, fetches the secrets, and writes them to a shared memory volume (/vault/secrets/) as files. The application reads these files. For dynamic database credentials, the agent template renders the username/password into a file and runs a command hook (or the application watches the file) to reload connections. The agent handles lease renewal automatically; if renewal fails, it revokes the old lease, fetches a new credential, and rewrites the file — no pod restart needed.
Why sidecar over CSI or SDK: The CSI driver is simpler but doesn't support dynamic secret renewal without remount (requires pod restart in older versions). The SDK approach requires every service to implement Vault client logic, which is impractical across 40+ services in different languages. The agent sidecar is language-agnostic, handles renewal transparently, and writes to tmpfs (shared memory) so secrets never touch disk.
Encryption Hierarchy:
- Vault's master key is protected by Shamir's Secret Sharing (unseal keys held by separate human custodians) or, preferably, by a cloud KMS auto-unseal (AWS KMS or GCP KMS). The master key encrypts the Raft storage backend where all data (including encrypted DEKs) resides.
- Vault internally uses barrier encryption: every value written to storage is encrypted with an AES-256-GCM key derived from the master key. No plaintext is ever persisted.
- For transit secrets (e.g., application-level field encryption), Vault's Transit engine acts as a KEK service: applications send plaintext to Transit, receive ciphertext, and store only ciphertext in their databases. The DEK never leaves Vault.
Key Rotation Strategy:
- Cloud KMS keys (auto-unseal KEK): rotate annually via cloud provider key rotation; Vault supports re-wrapping the master key.
- Transit keys: configure
auto_rotate_period(e.g., 30 days); old key versions remain available for decryption, new writes use the latest version. - Dynamic DB credentials: TTL of 1 hour with
max_ttlof 4 hours; the agent renews at TTL/2 (30 min) and fetches a new credential if renewal fails. - ServiceAccount tokens: short-lived (1 hour) JWTs auto-mounted by Kubernetes; the Vault agent re-authenticates as needed.
Blast-Radius Isolation (Requirement 4)
- Per-service policies: Each ServiceAccount maps to a Vault policy scoped to exactly its secret paths (e.g.,
secret/data/payments-service/*,database/creds/payments-service). A compromised pod's token can only read its own paths; Vault denies all other paths. - No shared ServiceAccounts: Every service has a unique ServiceAccount; no
defaultSA is used. - Short TTLs: Dynamic credentials expire in 1 hour; the ServiceAccount JWT expires in 1 hour. A stolen token has a narrow window.
- No secret caching beyond pod lifetime: The agent sidecar's token and leases are revoked when the pod terminates (via the
vault.hashicorp.com/agent-inject-token-volume-mountlifecycle or a preStop hook that callsvault token revoke -self). - Network policies: Restrict egress from each namespace so a compromised pod cannot reach other clusters' Vault endpoints or other services' databases directly.
- Response wrapping (optional): For especially sensitive secrets, use Vault response wrapping so the secret is delivered as a single-use wrapping token; even if intercepted, it can be unwrapped only once.
Auditability (Requirement 3)
Vault audit devices are enabled in both file and syslog modes. Every request (read, lease, renew, revoke) is logged with:
- The authenticated identity (K8s ServiceAccount name + namespace + cluster)
- The request path (which secret was accessed)
- The timestamp and operation type
- Whether the request was allowed or denied
Audit logs are streamed to a centralized log aggregator (e.g., Fluent Bit → Loki/Elasticsearch) and archived to an S3 bucket with Object Lock (WORM) and 1-year retention. For the 90-day requirement, an auditor queries the log store filtered by secret path to see every identity that accessed it. Because each ServiceAccount maps 1:1 to a service, the auditor can correlate access to a specific deployment and team owner via a ServiceAccount-to-team registry.
On EKS, CloudTrail captures all AWS Secrets Manager / KMS API calls as a secondary audit trail. On GKE, Cloud Audit Logs serve the same purpose.
Migration Plan (Zero Downtime)
Phase 1 — Inventory & Backfill (1-2 weeks):
Scan all Helm charts, Kustomize overlays, and CI/CD pipelines for secrets (using tools like truffleHog, gitleaks). Catalog every secret with its owner service, type (API key, DB password, TLS cert), and current storage location. Backfill all static secrets into Vault KV v2 at secret/data/<service>/<key>. Verify ACLs are in place.
Phase 2 — Dual-Read Sidecar Deployment (2-3 weeks):
For each service, add Vault Agent Injector annotations alongside existing env-var/K8s Secret mounts. The application is updated to read from the injected file (/vault/secrets/db-creds) as the primary source, with a fallback to the existing env var. Deploy via rolling update — no downtime. Both paths work simultaneously during this window.
Phase 3 — Static → Dynamic DB Credentials (1-2 weeks): Configure the Vault database secrets engine for each database. Update the agent template to render dynamic credentials instead of static KV values. The application's connection pool must handle credential changes (either via a file-watch reload or a health-check-driven reconnect). Roll out per-service with canary deployments.
Phase 4 — Cleanup (1 week): After monitoring confirms all services read exclusively from Vault, remove the old Kubernetes Secret objects and Helm values references. Run a final truffleHog scan on all repos to confirm no secrets remain in Git. Update CI/CD pipelines to never inject secrets directly — only Vault references.
Rollback: At any phase, if issues arise, the application falls back to env-var/K8s Secret values which remain in place until Phase 4. No big-bang cutover is required.
This is a staff-level design exercise because it requires integrating multiple subsystems — authentication, encryption hierarchies, dynamic credential lifecycle, audit pipelines, blast-radius isolation, and zero-downtime migration — into a coherent architecture. A strong answer must name concrete technologies, explain the trust chain from pod identity to secret access, address the renewal-without-restart requirement specifically (which rules out naive CSI-only approaches), and show a phased migration that never requires a big-bang cutover. The rubric rewards each requirement being addressed with a concrete mechanism, not just a mention. The corrected c1 criterion and sample answer now explicitly address that native K8s Secrets are base64-encoded not encrypted, that EncryptionConfiguration is defense-in-depth but insufficient alone, and that the design eliminates secrets from etcd rather than relying on at-rest encryption.
In envelope encryption, each secret is sealed with its own freshly generated _____, and that key is then wrapped (encrypted) by a _____ that never leaves the KMS. Name the two keys: the first is the per-object key that encrypts the payload, the second is the key that wraps it.#
Show answer
In envelope encryption, each secret is sealed with its own freshly generated data encryption key, and that key is then wrapped (encrypted) by a key encryption key that never leaves the KMS. Name the two keys: the first is the per-object key that encrypts the payload, the second is the key that wraps it.
Envelope encryption uses two layers. A unique data encryption key (DEK) encrypts the actual secret payload, so the bulk ciphertext is produced with fast symmetric crypto. That DEK is then encrypted under a key encryption key (KEK) held inside the KMS, and only the wrapped DEK is stored alongside the ciphertext. Because the KEK never leaves the KMS, it can be rotated by re-wrapping stored DEKs without re-encrypting the bulk data, which is why the two-layer structure is used.
Your company runs about 300 microservices across three Kubernetes clusters in two cloud providers. Workloads need access to PostgreSQL databases, cloud storage buckets, and about 40 third-party API keys. CI pipelines deploy to all clusters. Today, database passwords and API keys live in encrypted files in Git and in CI variables, and nobody can say which services use which credential. Last quarter a third-party key leaked in a build log and was not noticed for four months.#
Show answer
Storage: keep a single system of record, such as HashiCorp Vault or a cloud secret manager, with encryption at rest and a KMS-backed root key. Git holds only references and policy, never values. Each secret has an owner and a path, and access policies are written per workload identity, so reads are least-privilege.
Authentication: each pod authenticates with its Kubernetes service account token (or a SPIFFE SVID) through the broker's Kubernetes auth method, which validates the token against the cluster's API. CI jobs use OIDC federation from the CI provider to obtain a short-lived token, so no long-lived CI secret is stored. The initial trust comes from the platform's attestation of the pod or job identity, not from a secret placed in the image.
Dynamic credentials: database users and cloud role sessions are issued on demand by the broker with a short TTL (for example one hour), renewed by the sidecar or SDK, and revoked automatically on expiry. No static database password exists to leak. Third-party API keys that the provider cannot mint dynamically are stored as versioned secrets. Rotation creates version N+1 while N stays valid, workloads reference the latest version and reload on change, and N is revoked only after metrics show no requests using it.
Audit and detection: the broker logs every issuance and read with the authenticated identity, and logs are shipped to a central SIEM. Secret scanners run on every commit, build log, and artifact, and a hit triggers automatic alerting and revocation of the matched key through the provider's API. Applying this to the leaked key: the scanner would have flagged the build log within minutes of the first build, the revocation path would have invalidated the key, and the audit trail would show which identities had used it.
This is an open design problem graded by the weighted rubric. A strong answer prefers short-lived, identity-issued credentials for databases and cloud access, bootstraps trust through platform identity rather than a static token, handles non-dynamic third-party keys with overlapping versions and a verified cutover, and closes the loop with identity-attributed auditing and automated leak detection and revocation tied to the incident described.
Related interview questions
Job market
See devops salaries and hiring demand from live job postings.
The other 4 questions
This page shows 10 and marks what you pick. That's as far as a page can go. A free account opens the other 4 and keeps every answer. What you miss comes back until it's right: after a day, then at longer gaps.
Free · the whole bank · 100 marked answers per 30 days · written feedback on the paid plan