Skip to content

Kubernetes 101

Kubernetes 101 by Jeff Geerling

Episode 1

How to run Kubernetes for development

  • k3s
  • kind (Kubernetes in Docker)
  • minikube

Running on a local cluster

Setup cluster

minikube start

Print nodes

kubectl get nodes

Deploy an application

kubectl create deployment hello-k8s --image=hello-k8s

Expose an application

kubectl expose deployment hello-k8s --type=NodePort --port=80

Print services

kubectl get services hello-k8s

Cluster IP address

minikube ip

Access service inside the cluster

minikube service hello-k8s

Stop the cluster

minikube halt

Destroy the cluster

minikube delete

Episode 2

Switch docker context to minikube

eval $(minikube docker-env)

Episode 3

Use custom kubectl config

export KUBECONFIG=~/.kube/config-kube101

Watch deployment

watch kubectl get deployment hello-go

Get pod information

kubectl get pod -l app=hello-go

Get detailed pod information

kubectl describe pod -l app=hello-go

Create docker registry secret

kubectl create secret docker-registry regcred \
  --docker-username=bob \
  --docker-password=secret \
  [email protected]

Edit deployment descriptor

kubectl edit deployment hello-go

View logs

kubectl logs -f -l app=hello-go --prefix=true

Rollback the deployment

kubectl rollout undo deployment hello-go

Episode 4

Create namespace

kubectl create namespace test

Apply manifests

kubectl apply -f test.yml

Episode 5

  • Metrics server
  • Horizontal Pod Autoscaling

Episode 6

  • Ingress controller
  • cert-manager
  • CronJob