402 β€” RBAC and Security

Advanced

Master Role-Based Access Control (RBAC), service accounts, and security best practices for production Kubernetes clusters.

Learning Objectives

1
Understand RBAC concepts: Roles, ClusterRoles, Bindings
2
Create and manage ServiceAccounts
3
Implement least-privilege access
4
Apply security contexts and policies
Step 1

Create a ServiceAccount

ServiceAccounts provide identity for pods to interact with the API.

Commands to Run

kubectl create serviceaccount app-sa
kubectl get serviceaccount app-sa -o yaml
kubectl describe serviceaccount app-sa

What This Does

ServiceAccounts are pod identities. Each namespace has a default ServiceAccount. Create custom ones for specific permissions.

Expected Outcome

ServiceAccount created. Shows associated secret for API authentication token.

Pro Tips

  • 1
    Default ServiceAccount has minimal permissions
  • 2
    Each namespace has default ServiceAccount
  • 3
    Pods use default SA unless specified
  • 4
    SAs enable pod-to-API-server authentication
Was this step helpful?

All Steps (0 / 10 completed)