Welcome to the Kubernetes
Labs folder! This collection contains 8 different hands-on labs designed to enhance your understanding of Kubernetes
. Each lab focuses on a specific concept or feature of Kubernetes
, offering practical scenarios for learning and experimentation.
To get started with these labs, ensure the following prerequisites are met:
- A running Kubernetes cluster (e.g., Minikube, Kind, or a managed cluster).
kubectl
installed and configured.- Basic understanding of Kubernetes concepts.
For those using Minikube, you can start your cluster with the following command:
minikube start --driver=docker --cni=cilium --kubernetes-version=stable --extra-config=kubelet.authentication-token-webhook=true --extra-config=kubelet.authorization-mode=AlwaysAllow --extra-config=kubelet.cgroup-driver=systemd --extra-config=kubelet.read-only-port=10255 --insecure-registry="registry.k8s.io"
- Objective: Learn how to use a ConfigMap in
Kubernetes
to manage configuration data for your application. - Key Topics:
ConfigMap
,Deployment
- Folder:
lab1-ConfigMap
- Detailed Instructions
- Objective: In this lab, you will extend the previous exercise by creating two separate deployments of the same application.
- Key Topics:
ConfigMap
,Deployment
,Ingress
. - Folder:
lab2-Ingress
- Detailed Instructions
- Objective: Learn about
Kubernetes
persistence by deploying a PostgreSQL database using both Deployments and StatefulSets. - Key Topics:
PVC
,PV
,StorageClass
,Statefulset
. - Folder:
lab3-persistence
- Detailed Instructions
- Objective: This lab will guide you through the process of setting up a Kubernetes cluster using Kubeadm.
- Key Topics:
Kubernetes
components. - Folder:
lab4-kubeadm
- Detailed Instructions
- Objective: Learn how to create and apply Kubernetes Network Policies to control the communication between different applications in your cluster.
- Key Topics: NetworkPolicy.
- Folder:
lab5-NetworkPolicies
- Detailed Instructions
- Objective: This lab demonstrates how to set up a
Kubernetes
Horizontal Pod Autoscaler
(HPA) for adeployment
, stress the CPU, and observe scaling behavior. - Key Topics:
HPA
. - Folder:
lab6-HPA
- Detailed Instructions
- Objective: This lab demonstrates how to use
readiness
andliveness probes
inKubernetes
to ensure proper health checks for containers in your cluster. - Key Topics:
Liveness probes
,Readiness Probes
. - Folder:
lab7-probes
- Detailed Instructions
- Objective: This lab demonstrates how Kubernetes uses
taints
,tolerations
,node affinity
, andpod anti-affinity
to control pod scheduling. - Key Topics:
Taints
,Tolerations
,Node Affinity
,Pod Anti-affinity
. - Folder:
lab8-scheduling
- Detailed Instructions
- Navigate to the folder of the lab you wish to explore.
- Follow the instructions in the
README.md
file of the respective lab. - Experiment with the concepts and extend the labs as needed!
If you encounter issues or have suggestions for improvement, feel free to contribute by submitting a pull request or opening an issue in the repository.
Enjoy your Kubernetes learning journey!
minikube start --driver=docker --cni=cilium --insecure-registry="registry.k8s.io" --extra-config=apiserver.oidc-ca-file="" --extra-config=apiserver.authorization-mode=AlwaysAllow --extra-config=kubelet.authentication-token-webhook=false
minikube start --driver=docker --cni=cilium --kubernetes-version=stable --extra-config=kubelet.authentication-token-webhook=true --extra-config=kubelet.authorization-mode=AlwaysAllow --extra-config=kubelet.cgroup-driver=systemd --extra-config=kubelet.read-only-port=10255 --insecure-registry="registry.k8s.io"
kubectl -n kube-system patch deployment metrics-server --type='json' -p='[{ "op": "add", "path": "/spec/template/spec/containers/0/args", "value": [ "--kubelet-insecure-tls", "--cert-dir=/tmp", "--secure-port=10250", "--kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname", "--kubelet-use-node-status-port", "--metric-resolution=15s" ] }]'
"--cert-dir=/tmp" "--secure-port=10250" "--kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname" "--kubelet-use-node-status-port" "--metric-resolution=15s"