Advanced Kubernetes Secrets Handling and Best Practices
A deep dive into managing secrets securely in Kubernetes environments.
Questions in this quiz
10 questions on Advanced Kubernetes Secrets Handling and Best Practices. Work through them here, then start the quiz to answer them and see your score.
1.In Kubernetes, what is the primary benefit of using Secrets over ConfigMaps for sensitive data?
- ASecrets can be versioned automatically.
- BSecrets provide built-in access control.
- CSecrets are stored in a separate database.
- DSecrets are encrypted at rest by default.
2.Which Kubernetes component is responsible for ensuring that Secrets are only accessible by authorized pods?
- AAPI Server
- BController Manager
- CScheduler
- DKubelet
3.When using Kubernetes Secrets, what is a recommended practice for reducing the risk of exposure?
- AMount Secrets as volumes with minimal permissions.
- BUse environment variables for all Secrets.
- CInclude Secrets in container images.
- DStore Secrets in plaintext within the pod.
4.How can you ensure that a Kubernetes Secret is encrypted at rest in an etcd database?
- AStore the Secret in a ConfigMap instead.
- BEnable encryption at rest in the Kubernetes API Server configuration.
- CEncrypt the Secret manually before storing.
- DUse a third-party encryption tool.
5.What is the default behavior of Kubernetes when a Secret is updated?
- AThe Secret is automatically deleted and recreated.
- BPods need to be restarted to access updated Secret values.
- CPods using the Secret automatically reload the new values.
- DThe Secret is versioned and old versions are kept.
6.Which command can be used to create a Secret from a literal value in Kubernetes?
- Akubectl generate secret generic
- Bkubectl apply secret literal
- Ckubectl create secret generic
- Dkubectl add secret literal
7.What is a potential security risk when using environment variables to pass Secrets to containers?
- AEnvironment variables can be easily logged.
- BEnvironment variables are not accessible by the container.
- CEnvironment variables are encrypted by default.
- DEnvironment variables cannot be updated.
8.How can you restrict access to a Secret to specific namespaces in Kubernetes?
- AUse network policies.
- BConfigure pod security policies.
- CSet namespace-specific annotations.
- DUse Role-Based Access Control (RBAC).
9.Which of the following is a valid method to inject a Secret into a Kubernetes pod?
- AAs a label on the pod.
- BAs a command-line argument.
- CAs a file in a mounted volume.
- DAs a node selector.
10.What is the effect of setting a Secret as immutable in Kubernetes?
- AThe Secret can be deleted but not updated.
- BThe Secret cannot be updated or deleted.
- CThe Secret can be updated but not deleted.
- DThe Secret is automatically encrypted.