Kubernetes: Zero to Confident
0%
k8s-lab, bash
Welcome to the DevOpsLesson Kubernetes Lab ⎈
This is a safe, simulated Kubernetes cluster. Nothing runs on your machine.
Follow the steps on the left. Type a kubectl command below, or type 'help' anytime.
Every command this lab teaches
Kubernetes: Zero to Confident is 18 steps, about 30 minutes. Each one asks a question, you type the answer in the terminal above, and it is checked before you move on. Nothing is installed and nothing can break.
Beginner6 steps
- Print the kubectl client and server version.
kubectl version - Show the cluster’s control plane endpoints.
kubectl cluster-info - List the nodes in the cluster.
kubectl get nodes - List all namespaces.
kubectl get namespaces - Run a single nginx pod named “nginx”.
kubectl run nginx --image=nginx - List the pods in the default namespace.
kubectl get pods
Intermediate6 steps
- Describe the nginx pod.
kubectl describe pod nginx - Create a deployment named “web” from the nginx image.
kubectl create deployment web --image=nginx - List the deployments.
kubectl get deployments - Scale the “web” deployment to 3 replicas.
kubectl scale deployment web --replicas=3 - Expose the “web” deployment on port 80.
kubectl expose deployment web --port=80 - List the services.
kubectl get services
Advanced6 steps
- View the logs of one of your pods.
kubectl logs nginx - Exec a command inside a pod (e.g. ls).
kubectl exec nginx -- ls - Update the “web” deployment to a newer nginx image.
kubectl set image deployment/web nginx=nginx:1.27 - Check the rollout status of the “web” deployment.
kubectl rollout status deployment/web - Roll the “web” deployment back to its previous version.
kubectl rollout undo deployment/web - Delete the “web” deployment.
kubectl delete deployment web