Getting Started
Verify the Environment
Confirm the cluster is healthy and your kubeconfig is wired up before moving on.
Before moving into security controls, verify that your local cluster is healthy and that your shell is pointed at the right environment.
Most mistakes in Kubernetes labs come from using the wrong context, the wrong namespace, or a cluster that is not fully ready.
Verify the Current Context
Check the active context:
kubectl config current-context
Expected output:
kind-k8s-security-lab
If you see a production, shared, or cloud cluster context, stop and switch back:
kubectl config use-context kind-k8s-security-lab
Verify the Default Namespace
Check the namespace on the current context:
kubectl config view --minify --output 'jsonpath={..namespace}'; echo
Expected output:
lab
If the output is empty or different, set it:
kubectl config set-context --current --namespace=lab
Verify Cluster Health
Check the nodes:
kubectl get nodes
The node should be Ready.
Check core pods:
kubectl get pods -n kube-system
For a fresh local cluster, Running and Completed are normal. Pods stuck in Pending, CrashLoopBackOff, or ImagePullBackOff need investigation before you continue.
Verify API Access
Ask the API server for basic version information:
kubectl version
Then check what your current identity can do in the lab namespace:
kubectl auth can-i get pods
kubectl auth can-i create deployments
kubectl auth can-i create clusterroles
In a default local kind cluster, your user is effectively a cluster administrator. That is useful for learning because you can create and remove security controls freely. It is not the permission model you should use for day-to-day work in a shared cluster.
Verify a Test Workload Can Run
Create a short-lived pod:
kubectl run verify --image=busybox:1.36 --restart=Never --command -- sh -c 'echo ready && sleep 5'
Watch it complete:
kubectl get pod verify
Read the logs:
kubectl logs verify
Expected output:
ready
Clean it up:
kubectl delete pod verify
Troubleshooting Checklist
If verification fails, check these items first:
- The container runtime is running.
kubectl config current-contextiskind-k8s-security-lab.- The node is
Ready. - CoreDNS pods in
kube-systemare running. - Your machine can pull container images.
- You are not accidentally using a restricted corporate or production kubeconfig.
Once these checks pass, the environment is ready for the rest of the Kubernetes Security foundation.