0
0
Kubernetesdevops~20 mins

Base64 encoding in Secrets in Kubernetes - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Base64 Secrets Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate
1:30remaining
Base64 encoding of a secret string
What is the output of the following command?
echo -n 'mypassword' | base64
Kubernetes
echo -n 'mypassword' | base64
AbXlwYXNzd29yZA==
BbXlwYXNzd29yZA=
CbXlwYXNzd29yZA
DbXlwYXNzd29yZA==\n
Attempts:
2 left
💡 Hint
Remember that base64 output includes padding with '=' characters.
🧠 Conceptual
intermediate
1:30remaining
Why encode secrets in base64 in Kubernetes?
Why does Kubernetes require secret data to be base64 encoded in Secret manifests?
ABecause base64 encrypts the secret making it secure from unauthorized access.
BBecause Kubernetes only accepts ASCII characters in YAML files and base64 ensures binary data is safe.
CBecause base64 compresses the secret data to save space in etcd.
DBecause base64 converts the secret into JSON format for Kubernetes to read.
Attempts:
2 left
💡 Hint
Think about what base64 does to data and what YAML supports.
Configuration
advanced
2:00remaining
Correct base64 encoding in a Kubernetes Secret manifest
Which Secret manifest correctly encodes the password 'admin123' in base64?
A
apiVersion: v1
kind: Secret
data:
  password: admin123
metadata:
  name: mysecret
B
apiVersion: v1
kind: Secret
stringData:
  password: admin123
metadata:
  name: mysecret
C
apiVersion: v1
kind: Secret
stringData:
  password: YWRtaW4xMjM=
metadata:
  name: mysecret
D
apiVersion: v1
kind: Secret
data:
  password: YWRtaW4xMjM=
metadata:
  name: mysecret
Attempts:
2 left
💡 Hint
Check if the field is 'data' or 'stringData' and whether the value is base64 encoded or plain text.
Troubleshoot
advanced
1:30remaining
Error decoding secret data in Kubernetes
You applied a Secret manifest with this data field:
password: YWRtaW4xMjM

What error will Kubernetes report when trying to decode this secret?
AError decoding base64: illegal base64 data at input byte 11
BError: missing required field 'metadata'
CNo error, secret decoded successfully
DError: invalid YAML syntax
Attempts:
2 left
💡 Hint
Check if the base64 string is properly padded.
Best Practice
expert
2:00remaining
Secure handling of base64 encoded secrets in Kubernetes
Which practice is the most secure when managing base64 encoded secrets in Kubernetes?
AEncode secrets with base64 and commit them to public repositories for transparency.
BManually decode secrets from base64 before applying them to Kubernetes to avoid encoding errors.
CUse Kubernetes External Secrets or sealed-secrets tools to manage secrets outside Git.
DStore base64 encoded secrets directly in Git repositories with restricted access.
Attempts:
2 left
💡 Hint
Think about how to avoid exposing secrets in source control.