Skip to content

Part 1: Foundations

This section gets your local environment set up and teaches you the core tools you will use every day. By the end of Part 1 you will have k0s running, kubectl configured, Helm installed, and k9s available for day-to-day monitoring.

Before starting, make sure you have the following installed:

ToolPurposeInstall
k0sLightweight Kubernetes distributionk0s.io — follow their quickstart
kubectlCLI for interacting with the clusterkubernetes.io/docs/tasks/tools/
HelmPackage manager for Kuberneteshelm.sh/docs/intro/install/
k9sTerminal UI for cluster monitoringk9scli.io
mkcertLocal CA for trusted dev certsgithub.com/FiloSottile/mkcert

Tip: Install mkcert now even though you won’t use it until Part 4. Running mkcert -install early ensures your local CA root is trusted by your browser and OS.

After installing k0s, confirm the cluster is running and kubectl can reach it:

Terminal window
# Check cluster status
sudo k0s status
# Export kubeconfig (adjust path if needed)
sudo k0s kubeconfig admin > ~/.kube/config
chmod 600 ~/.kube/config
# Verify connectivity
kubectl cluster-info
kubectl get nodes

You should see your node listed with status Ready. If not, check that the k0s service is running and your kubeconfig path is correct.

These tools work together but serve different purposes:

ToolWhat It DoesWhen You Use It
kubectlTalks to the Kubernetes APIScripting, one-off commands, debugging
HelmDeploys and manages app releasesInstalling, upgrading, and templating apps
k9sTUI for browsing cluster stateDay-to-day monitoring and interactive debugging

Key relationships: Helm and kubectl both talk directly to the Kubernetes API server. Helm does not call kubectl. k9s is a visual layer over what kubectl shows you. For deploying apps, pick either Helm or raw kubectl for a given resource, not both. See Helm vs Kustomize for guidance on when to use each.

These commands cover 90% of daily use:

Terminal window
# Viewing resources
kubectl get pods # list pods in current namespace
kubectl get pods -A # all namespaces
kubectl get deployments
kubectl get services
kubectl get ingress
# Inspecting
kubectl describe pod <name> # detailed info
kubectl logs <pod-name> # container logs
kubectl logs <pod-name> -f # follow/stream logs
# Debugging
kubectl exec -it <pod> -- /bin/sh # shell into a pod
kubectl port-forward svc/<name> 8080:80
# Understanding resources
kubectl explain deployment # schema docs
kubectl explain pod.spec.containers # drill into fields
# Generating starter YAML
kubectl create deployment my-app --image=nginx \
--dry-run=client -o yaml > deployment.yaml

Tip: kubectl explain is your best friend. It gives you the full spec for any Kubernetes object right in your terminal.

Namespaces are logical partitions within your cluster. You will use them to isolate dev, staging, and production workloads.

Terminal window
# Create namespaces for your environments
kubectl create namespace dev
kubectl create namespace staging
kubectl create namespace production
# List namespaces
kubectl get namespaces
# Set a default namespace for your session
kubectl config set-context --current --namespace=dev