Mastering Kubernetes Secrets Management
An advanced quiz on managing secrets in Kubernetes environments.
Questions in this quiz
10 questions on Mastering Kubernetes Secrets Management. Work through them here, then start the quiz to answer them and see your score.
1.In Kubernetes, which of the following commands is used to create a secret from a literal value?
- Akubectl create secret mysecret --from-literal=key1=value1
- Bkubectl create secret generic mysecret --from-literal=key1=value1
- Ckubectl create secret literal mysecret --from-literal=key1=value1
- Dkubectl create secret generic --from-literal=key1=value1 mysecret
2.What is the primary advantage of using Kubernetes Secrets over ConfigMaps for sensitive data?
- ASecrets are stored in base64 encoding, making them secure.
- BSecrets are encrypted at rest and can be restricted by RBAC.
- CSecrets can be versioned, unlike ConfigMaps.
- DSecrets are automatically backed up by Kubernetes.
3.Which Kubernetes resource can be used to automatically inject secrets into a container's environment variables?
- ASecret
- BServiceAccount
- CVolume
- DConfigMap
4.How can you ensure that a Kubernetes Secret is only accessible by a specific namespace?
- ABy using a namespace selector in the Secret definition.
- BBy setting a namespace-specific label on the Secret.
- CBy creating the Secret within the desired namespace.
- DBy assigning a unique identifier to the Secret.
5.Which of the following is NOT a recommended practice for managing secrets in Kubernetes?
- ARestricting access to secrets using RBAC.
- BEncrypting secrets at rest using etcd encryption.
- CUsing external secret management tools like HashiCorp Vault.
- DEmbedding secrets directly in Pod specifications.
6.What is the default behavior of Kubernetes when a Secret is updated?
- APods using the Secret continue to use the old version until manually updated.
- BThe Secret is versioned, and Pods can choose which version to use.
- CAll Pods using the Secret are automatically restarted.
- DThe updated Secret is immediately available to all consuming Pods.
7.Which Kubernetes feature allows you to synchronize secrets from an external secret management system?
- ASecret Sync Daemon
- BExternal Secrets Operator
- CConfigMap Synchronizer
- DKubernetes Secrets Controller
8.What is the role of the 'data' field in a Kubernetes Secret manifest?
- AIt specifies the metadata for the Secret.
- BIt defines the access policies for the Secret.
- CIt contains the base64-encoded secret data.
- DIt lists the namespaces where the Secret can be used.
9.How can you prevent a Kubernetes Secret from being exposed in logs?
- ABy setting the 'hideFromLogs' attribute in the Secret manifest.
- BBy using the 'kubectl hide' command.
- CBy ensuring secrets are not printed in logs by applications.
- DBy using the 'no-log' flag when creating the Secret.
10.Which command would you use to decode a base64-encoded secret value retrieved from a Kubernetes Secret?
- Adecode64 <base64_value>
- Becho <base64_value> | base64 --decode
- Ckubectl decode secret <base64_value>
- Dopenssl decode -base64 <base64_value>