Certified Kubernetes Application Developer (CKAD) · Section 4 · 25% of the exam
Understand ServiceAccounts
One of the objectives of the Certified Kubernetes Application Developer (CKAD) exam, in the section “Application Environment, Configuration and Security”. Here is what it covers, the points to remember and a question to try.
What it covers
A ServiceAccount is the identity that Pods use to talk to the API server. This lesson covers the default ServiceAccount, creating and assigning accounts, short-lived projected tokens, kubectl create token, turning off token automount, granting permissions with RBAC and attaching image pull secrets.
Points to remember
- A ServiceAccount is a namespaced identity for Pods; every namespace has a default ServiceAccount that is used when a Pod names none.
- A ServiceAccount's username is system:serviceaccount:<namespace>:<name>; use it with kubectl auth can-i --as.
- RoleBinding subjects for ServiceAccounts need kind: ServiceAccount, name and namespace; the imperative flag is --serviceaccount=<ns>:<name>.
- Pods get a short-lived, bound token through a projected volume at /var/run/secrets/kubernetes.io/serviceaccount/ (token, ca.crt, namespace).
- kubectl create token <sa> issues a token that expires after 1 hour by default (--duration changes it).
Try a question
What is the username that RBAC sees for the ServiceAccount builder in the namespace ci?
- A
serviceaccount:[email protected] - B
system:ci:builder - C
system:serviceaccount:ci:builder - D
builder
Show the answer
C. You use this form with kubectl auth can-i --as, and in RBAC subjects you write kind: ServiceAccount, name: builder, namespace: ci.
Written for practice in the style of the exam: never a question from the real exam.
In the course
The lesson ServiceAccounts teaches this objective (about 40 minutes), and 9 practice questions test it. The course has lessons, exam-style questions, timed practice exams and an AI tutor for every objective, and a pass prediction that tells you when you're ready to book.
More in this section
- Discover and use resources that extend Kubernetes (CRD, Operators)
- Understand authentication, authorization and admission control
- Understand requests, limits, quotas
- Define resource requirements
- Understand ConfigMaps
- Create & consume Secrets
- Understand Application Security (SecurityContexts, Capabilities, etc.)