CKS Minimize Microservice Vulnerabilities Practice Question
Which TWO of the following are best practices for securing secrets in Kubernetes?
⚠ Common exam trap
The CKS exam often tests the misconception that storing secrets as environment variables is acceptable because it is 'convenient' or 'standard practice,' but the CKS exam strictly penalizes this as insecure due to exposure in process listings and logs.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
Enabling encryption at rest for secrets
Kubernetes stores secrets in etcd by default without encryption. Enabling encryption at rest (via the EncryptionConfiguration resource with a provider like AES-CBC or KMS) ensures that secret data is encrypted before being written to etcd, protecting it from unauthorized access to the underlying storage. This is a fundamental security control required for compliance and defense-in-depth.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Storing secrets as environment variables
Why it's wrong here
Storing secrets as environment variables is not a best practice because any process running in the same pod inherits the environment, and on Linux those values are exposed in /proc/<pid>/environ, which can be read by other processes with sufficient privileges. Secrets in environment variables also appear in shell history, CI/CD logs, and debugging output, and they cannot be easily rotated without restarting the workload. The recommended approach is to mount secrets as files into a read-only volume or use an external secrets provider with dynamic injection.
- ✗
Using the default secret type (Opaque) for all secrets
Why it's wrong here
Using the default Opaque secret type for all secrets gives a false sense of security because Opaque merely indicates that the secret contains arbitrary user data, and the payload is only base64-encoded, not encrypted. The type itself offers no protection; anyone with permission to read the secret via the Kubernetes API can trivially decode the base64 representation. Security depends on RBAC restrictions, encryption at rest, and secure storage—not on the secret type—so designating secrets as Opaque does not address the actual risks.
- ✓
Enabling encryption at rest for secrets
Why this is correct
Enabling encryption at rest for secrets is a core hardening measure because by default secrets are stored in etcd in base64-encoded plaintext, and an attacker who compromises etcd can read every secret in the cluster. Configure the kube-apiserver with an encryption provider such as AES-CBC, KMS, or AWS/GCP KMS, ensuring that the encryption keys are managed outside of etcd. This adds a layer of protection so that even if etcd backups or volumes are exposed, the secrets remain unreadable without the decryption keys.
- ✗
Limiting the number of secrets in the cluster
Why it's wrong here
Limiting the number of secrets in a cluster does not inherently improve security because the risk is not in how many secrets exist but in how they are accessed, stored, and rotated. A single poorly protected secret with broad RBAC can compromise the entire cluster, whereas many secrets guarded by least-privilege policies, encryption, and automated rotation remain safe. Reducing the count may even lead to overloading one secret with multiple purposes, increasing the blast radius if it is exposed.
- ✓
Using an external secrets management system like HashiCorp Vault
Why this is correct
Using an external secrets management system like HashiCorp Vault is a best practice because it centralizes secret storage with native features such as dynamic secret generation, automatic rotation, lease-based expiration, and detailed audit logs. Integrations like the Vault Secret Operator or CSI provider allow Kubernetes workloads to fetch secrets on demand without persisting them in etcd, reducing exposure in the cluster. This architecture decouples secret lifecycles from the platform, enabling fine-grained access control and ensuring that leaked secrets are short-lived and easily revoked.
Quick reference
Symmetric Encryption Algorithm Comparison
| Algorithm | Key Size | Block Size | Status | Notes |
|---|---|---|---|---|
| AES-128 | 128-bit | 128-bit | Current standard | NIST approved; WPA3, TLS |
| AES-256 | 256-bit | 128-bit | Current standard | Preferred for sensitive / govt data |
| 3DES | 112-bit effective | 64-bit | Deprecated (2023) | Replaced by AES |
| DES | 56-bit | 64-bit | Broken | Cracked in < 24 h; never deploy |
| ChaCha20 | 256-bit | Stream cipher | Current | TLS 1.3, WireGuard |
Go deeper
Related to this question
About these practice questions
Courseiva writes every CKS question from scratch — 845 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This CKS practice question is part of Courseiva's free CNCF certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the CKS exam.