Kubernetes Beginner
Introduction
Introduction to Kubernetes
The Kubernetes Course Series
Kubernetes Overview
Containers Overview
Containers Orchestration
Kubernetes Architecture
Setting Up Kubernetes
- Minikube
- Bundles all the k8 components into a single node
- MicroK8s
- kubeadm
- Tool to bootstrap a cluster
- AWS
- Azure
- GCP
- www.codecloud.com
kubectl
- command line utility
Commands
kubectl
Check the version
kubectl version client
kubectl version
Check that vertualisation is enabled
sysctl -a | grep -E --color 'machdep.cpu.features|VMX'
Virtualbox
- Install Virtual Box
- Guest OS
Minikube
Installation
- Install and start Minikube
brew install minikube
minikube start --driver=virtualbox
- Downlaods Minikube iso and Kubernetes + docker images
- Creates a Virtualbox VM
- Prepares Kubernetes and Docker
- Configures kubectl to use minikube
- A virtual machine named minikube should to running
- Open Virtual Box UI and verify
Check status, stop, start
Status of cluster
minikube status
Stop cluster
minikube stop
Start cluster
minikube start
Open Kuberneted dashboard, supported by minikube, built-in
minikube dashboard
Deploy Application
kubectl get nodes
Deploy an application
kubectl create deployment hello-minikube --image=k8s.gcr.io/echoserver:1.10
kubectl get deployments
Expose deployment as a service
kubectl expose deployment hello-minikube --type=NodePort --port=8080
The hello-minikube Pod is now launched but you have to wait until the Pod is up before accessing it via the exposed Service
kubectl get pod
Get the URL of the exposed Service to view the Service details
minikube service hello-minikube --url
Cleanup
kubectl delete services hello-minikube
kubectl delete deployment hello-minikube
Hands on Lab/ Demo
kubectl get nodes -o wide
- Create an nginx pod:
kubectl run nginx --image nginx
kubectl describe pod nginx
kubectl get pods -o wide
Introduction to YAML
- Coding exercise answers https://github.com/mmumshad/kubernetes-training-answers
Kubernetes Concepts
PODs, ReplicsSets and Deployments
Labels help to filter the pods
Create pod.yaml
file
Run the following command to create the pod
kubectl apply pod.yaml
Notes
Install VS Code extension for yaml support
Ctrl + Space to get auto suggestion.
Reference
https://kubernetes.io/docs/tasks/access-application-cluster/web-ui-dashboard/
https://kube.academy/lessons/kubernetes-concepts - Declarative v/s Imperative, Control Loop
https://kube.academy/courses
https://sysdig.com/blog/debug-kubernetes-crashloopbackoff/
https://sysdig.com/products/monitor/