LAB02d: Setting up Kubeconfig
How kubeconfig works
How to create new users
How to create new contexts
How to switch between users/contexts
How to merge multiple kubeconfig files
How to view certificates/server details
How to test RBAC access using kubeconfig
LAB: Mastering Kubeconfig (100% Commands, No YAML)
1. Identify your current kubeconfig location
echo $KUBECONFIG2. Copy kubeconfig to a fresh lab file (safe practice)
3. Create a new user from commands (password or token method)
Option A — Basic username+password user
Option B — Token-based user (common in OIDC)
Option C — Client certificate (recommended in kubeadm labs)
4. Create a new context for user ram
ram5. Switch to new context (this changes your “identity”)
6. Test access using new user
7. Add namespace to context (modify existing context)
8. Create another kubeconfig and MERGE
9. Rename a context (command only)
10. Remove (delete) a user, cluster, or context
11. Show certificate + cluster server details
12. Create a kubeconfig for a single user only
PreviousLAB02c: Create a New Kubernetes User Using Certificate AuthenticationNextBLOG03: Kubernetes Cluster Administration
Last updated