Challenge - 5 Problems
Service Account Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate1:30remaining
Output of listing service accounts in a namespace
What is the output of the following command when run in a namespace with two service accounts named
default and custom-sa?Kubernetes
kubectl get serviceaccountsAttempts:
2 left
💡 Hint
Use
kubectl get serviceaccounts to list all service accounts with their secrets and age.✗ Incorrect
The
kubectl get serviceaccounts command lists all service accounts in the current namespace showing their names, number of secrets, and age.🧠 Conceptual
intermediate1:00remaining
Purpose of Kubernetes service accounts
Which option best describes the main purpose of a Kubernetes service account?
Attempts:
2 left
💡 Hint
Think about how pods authenticate to the Kubernetes API server.
✗ Incorrect
Service accounts provide an identity for pods so they can securely communicate with the Kubernetes API server.
❓ Configuration
advanced2:00remaining
Correct YAML for creating a service account
Which YAML snippet correctly creates a service account named
my-service-account in the production namespace?Attempts:
2 left
💡 Hint
Namespace must be under metadata and spelled exactly as 'production'.
✗ Incorrect
The namespace must be specified under metadata with the exact name. Labels do not set namespace. The field
namespace outside metadata is invalid.❓ Troubleshoot
advanced1:30remaining
Reason for pod failing to access Kubernetes API with service account
A pod using a service account
custom-sa cannot access the Kubernetes API and gets a 403 Forbidden error. What is the most likely cause?Attempts:
2 left
💡 Hint
Check if the service account has permissions assigned via roles.
✗ Incorrect
A 403 Forbidden error usually means the service account lacks permissions granted by Role or ClusterRole bindings.
🔀 Workflow
expert2:30remaining
Order of steps to create and use a service account in a pod
Arrange the steps in the correct order to create a service account and use it in a pod.
Attempts:
2 left
💡 Hint
Permissions must be granted before the pod uses the service account.
✗ Incorrect
First create the service account, then assign permissions, then reference it in the pod spec, and finally deploy the pod.