KUBERNETES TUTORIAL · KUBECTL SIMULATOR · 30 LESSONS
Kubernetes for Go developers
Learn Kubernetes the way you will use it: by running kubectl against a cluster and watching it react. Thirty lessons explain the control plane, Pods, Deployments and rolling updates, probes, resources and scheduling, Services, DNS, Ingress and NetworkPolicy, ConfigMaps, Secrets, storage and RBAC, then autoscaling, node failures, Kustomize and Helm, client-go and a production checklist. Every lesson ends with commands to try in the DevOps terminal, whose simulated cluster has a scheduler, rolling updates, probes, CrashLoopBackOff, endpoints and simulated traffic. It runs in your browser now and in GopherForge for iPhone and iPad from 1.3.7. It is a teaching model, not Kubernetes: no containers run.
Start with “How a cluster works: control plane, nodes and reconciliation loops” →
Who it is for
Go developers who deploy to Kubernetes, or are about to, and want to understand what kubectl changes, why a rollout stalls and how traffic reaches a pod, without needing a cluster to practise on.
Before you start
Comfort with a shell and with containers (an image, a port, environment variables). Go helps for the client-go lesson; no cluster is needed.
What you will be able to do
- Explain the control plane and reconciliation, read any object's spec and status, and know which context and namespace every kubectl command targets.
- Run Deployments with rolling updates and rollbacks, configure readiness, liveness and startup probes, and size requests and limits for the QoS you need.
- Expose workloads with Services, DNS and Ingress, lock traffic down with NetworkPolicy, and debug latency, errors and saturation end to end.
- Configure pods with ConfigMaps, Secrets and volumes, divide a cluster with namespaces, quotas and RBAC, and package manifests with Kustomize and Helm.
- Autoscale with the HorizontalPodAutoscaler, survive node failures and drains, talk to the API from Go with client-go, and ship a Deployment that passes a production checklist.
Unit 1. Kubernetes foundations: the cluster and kubectl
Control plane and nodes, kubeconfig contexts and namespaces, the anatomy of an object, Pods, labels and selectors, declarative apply and kustomize.
How a cluster works: control plane, nodes and reconciliation loops
Name the control-plane and node components, trace a kubectl apply from the API request to a running container, and inspect the nodes and system pods of a kind cluster.
6 min · Worked lesson
kubeconfig, contexts and namespaces: know where every kubectl command goes
Read a kubeconfig, list, create and switch contexts, set a default namespace, and use -n, -A and explicit contexts so that commands reach the cluster and namespace you intend.
6 min · Worked lesson
Anatomy of an object: apiVersion, kind, metadata, spec and status
Write a manifest from scratch or from a dry-run scaffold, tell spec from status, choose between labels and annotations, look fields up with kubectl explain, read live state with jsonpath and recognise strict validation errors.
6 min · Worked lesson
Pods: shared containers, phases, container states and restart policy
Run and inspect pods, tell the pod phase from container states and the STATUS column, choose a restartPolicy, use logs and exec, and explain why controllers rather than people should create pods.
6 min · Worked lesson
Labels and selectors: how controllers and Services find their pods
Label objects, query them with equality-based and set-based selectors, explain how ReplicaSets and Services choose pods by label, and predict what relabelling a pod does.
6 min · Worked lesson
Declarative configuration with kubectl apply, manifest directories and kustomize
Manage objects from version-controlled manifests with kubectl apply, interpret created, configured and unchanged, apply and delete whole directories, and produce per-environment variants with kustomize.
6 min · Worked lesson
Unit 2. Workloads: Deployments, rollouts and jobs
ReplicaSets and self-healing, rolling updates and rollbacks, probes, requests and limits, scheduling, StatefulSets, DaemonSets, Jobs and CronJobs.
Deployments, ReplicaSets and Pods: the controller chain behind every replica
Create a Deployment, trace its ReplicaSet and Pods through labels and owner references, read the READY, UP-TO-DATE and AVAILABLE columns, and watch the controllers scale and replace Pods.
5 min · Worked lesson
Rolling updates: maxSurge, maxUnavailable, rollout history, undo and stalled rollouts
Configure a Deployment's update strategy, predict how many Pods exist during a rollout, follow and steer it with kubectl rollout, and recover from a release that never becomes ready.
5 min · Worked lesson
Readiness, liveness and startup probes: routing traffic and restarting stuck containers
Choose the right probe for each question, configure its timing, implement /readyz and /healthz handlers in a Go service, and avoid the probe settings that cause outages.
5 min · Worked lesson
Resource requests and limits, CPU throttling, OOMKills and QoS classes
Set requests and limits deliberately, predict how the scheduler and the kernel use them, recognise CPU throttling and OOMKilled containers, and know which QoS class each workload gets.
5 min · Worked lesson
Scheduling: node selection, affinity, taints and tolerations, spreading and draining nodes
Explain how the scheduler filters and scores nodes, steer Pods with nodeSelector and affinity, keep them off nodes with taints, and read FailedScheduling messages after a cordon, a drain or a bad constraint.
6 min · Worked lesson
StatefulSets for stable identity and storage, DaemonSets for one Pod per node
Run a StatefulSet with a headless Service and volumeClaimTemplates, predict its ordering and storage behaviour, and run a DaemonSet that covers every node, tainted ones included.
5 min · Worked lesson
Jobs and CronJobs: batch work with retries, deadlines and schedules
Run Jobs with completions, parallelism, backoffLimit and activeDeadlineSeconds, schedule them with CronJobs and a concurrency policy, trigger a run by hand, and write batch code that is safe to retry.
5 min · Worked lesson
Unit 3. Networking: Services, DNS, Ingress and policies
ClusterIP, NodePort and LoadBalancer Services, endpoints and targetPort, cluster DNS, Ingress routing, NetworkPolicies and end-to-end traffic debugging.
Services: a stable virtual IP and DNS name in front of changing pods
Expose a Deployment through a ClusterIP Service, trace a request from selector to endpoints to targetPort, and fix a wrong targetPort and a selector that matches no pods.
6 min · Worked lesson
Service types: NodePort, LoadBalancer, ExternalName and headless Services
Pick the right Service type for each job, reach a NodePort and a LoadBalancer from outside the cluster, and explain what externalTrafficPolicy changes.
5 min · Worked lesson
Cluster DNS: CoreDNS, service names, search domains and ndots
Resolve Services and StatefulSet pods by short and fully qualified names across namespaces, explain the extra lookups that ndots:5 causes, and debug name resolution from inside a pod.
6 min · Worked lesson
Ingress: route HTTP by host and path through an ingress controller
Write an Ingress with host and path rules for an IngressClass, route two Services behind one entry point, and tell a controller 404 from a controller 503.
6 min · Worked lesson
NetworkPolicies: default deny and label-based allow-lists for pod traffic
Isolate pods with NetworkPolicies, allow traffic by pod label, namespace and IP block, build a default-deny baseline that keeps DNS working, and verify enforcement from a client pod.
6 min · Worked lesson
Debugging traffic end to end: latency, saturation, errors and rollbacks
Follow a request from client to container port, read latency, saturation and error signals under load, and fix an overloaded Service and a bad release with scaling and kubectl rollout undo.
6 min · Worked lesson
Unit 4. Configuration, secrets, storage and access
ConfigMaps and Secrets as environment and files, PersistentVolumeClaims and StorageClasses, namespaces and quotas, ServiceAccounts and RBAC.
ConfigMaps: settings for pods through env, envFrom and mounted files
Store non-secret settings in a ConfigMap, consume them as environment variables or files, diagnose a missing ConfigMap or key, and roll pods so that they pick up a change.
6 min · Worked lesson
Secrets: credentials for pods, and why base64 is not protection
Create Secrets from literals or stringData, deliver them as variables or files, and name the controls that actually keep them confidential: RBAC, encryption at rest, external managers and careful logging.
6 min · Worked lesson
Volumes and persistent storage: emptyDir, PersistentVolumeClaims and StorageClasses
Choose between ephemeral and persistent volumes, request storage with a PersistentVolumeClaim, read binding and provisioning status, and diagnose a pod stuck Pending on its claim.
5 min · Worked lesson
Namespaces, ResourceQuotas and LimitRanges: dividing one cluster between teams
Use namespaces to scope names, access and policy, tell which objects are cluster-wide, cap a team's consumption with ResourceQuota and LimitRange, and delete a namespace knowing what goes with it.
5 min · Worked lesson
RBAC: ServiceAccounts, Roles and bindings for least-privilege API access
Tell authentication from authorization, grant a ServiceAccount exactly the verbs it needs with a Role and RoleBinding, verify the result with kubectl auth can-i, and call the API from Go with the pod's own identity.
6 min · Worked lesson
Unit 5. Operating, scaling and debugging
A triage method for broken pods, autoscaling under load, node failures and drains, kustomize and Helm, client-go controllers and a production checklist.
Debug failing pods: get, describe, logs, exec and events in order
Find out why a pod is not working by reading its STATUS, the Events in describe, the current and previous logs, the container from inside and the namespace events, and fix the most common failures.
5 min · Worked lesson
Autoscale pods on CPU with the HorizontalPodAutoscaler, VPA and cluster autoscaler
Create an autoscaling/v2 HorizontalPodAutoscaler on CPU utilization, predict its replica count from the formula, tune how fast it scales up and down, and place the Vertical Pod Autoscaler and the cluster autoscaler next to it.
6 min · Worked lesson
When a node dies: NotReady, eviction, PodDisruptionBudgets and safe drains
Explain the timeline from a lost node to rescheduled pods, protect planned maintenance with a PodDisruptionBudget, drain a node safely, and spread replicas so that one node or zone cannot take a service down.
6 min · Worked lesson
Package manifests per environment with Kustomize overlays, Helm charts and GitOps
Build per-environment manifests from a shared base with Kustomize transformers and kubectl apply -k, explain Helm charts, values and releases, and choose between them and a GitOps controller.
6 min · Worked lesson
Talk to the Kubernetes API from Go with client-go, informers and workqueues
Build a clientset from in-cluster or kubeconfig credentials, watch objects through a shared informer and lister, reconcile keys from a rate-limited workqueue, and shut a Go service down cleanly on SIGTERM.
7 min · Worked lesson
A production checklist for Deployments, applied to gopherforge/web:v2 in the lab
Review a Deployment against a production checklist and write one that pins its image, sizes its resources, probes its health, survives disruptions, runs with least privilege and shuts down cleanly.
6 min · Worked lesson
Related: Around Go: containers · Around Go: Kubernetes · Around Go: DevOps and reliability