Lecture 3
Lecture 3
Container Orchestration
DevOps Fundamentals
Container Orchestration
K8s
Kubernetes Core Concepts
🆃 2 CPUs or more
🆃 2GB of free memory
🆃 20GB of free disk space
🆃 Internet connection
🆃 Container or virtual machine manager, such as: Docker,
QEMU, Hyperkit, Hyper-V, KVM, Parallels, Podman,
VirtualBox, or VMware Fusion/Workstation
🆃 References:
https://minikube.sigs.k8s.io/docs/start/?arch=%2Fmacos%2
Farm64%2Fstable%2Fbinary+download#Service
Installation Complete
Let’s Get Started Test Application
kubernetes_application.yaml
apiVersion: v1
kind: Pod
metadata:
name: kub-app-pod
spec:
🆃 kubectl apply -f kubernetes_application.yaml
containers: 🆃 kubectl get pods
- name: kub-app-container 🆃 kubectl port-forward kub-app-pod 8080:80
image: nginx:latest
🆃 kubectl port-forward kub-app-pod 8080:80 &
(run in background)
ports:
- containerPort: 80
Architecture Explained (Master Node)
The Master Node serves as the central control unit of a Kubernetes cluster,
managing its overall state and operations. It oversees key functions such as
scheduling pods, monitoring the health of nodes and applications, and scaling
resources as needed.
Key components of the Master Node include:
Nodes
Example:
🆃 Deployments create and manage Creates a Deployment named nginx-deployment with 3 replicas.
ReplicaSets, which in turn manage the
Uses a ReplicaSet to manage pod scaling and availability.
actual pods.
Runs Nginx on port 80, ensuring multiple instances for load balancing
and fault tolerance.
StatefulSet
🆃 apiVersion: apps/v1
🆃 A StatefulSet in Kubernetes is used to manage 🆃 kind: StatefulSet
🆃 metadata:
stateful applications that require stable, 🆃 name: mysql
persistent storage and network identities. 🆃
🆃
spec:
serviceName: "mysql"
🆃 Unlike Deployments, StatefulSets assign each 🆃 replicas: 2
🆃 selector:
pod a unique, stable hostname and maintain 🆃 matchLabels:
their order during scaling or restarts. 🆃
🆃
app: mysql
template:
🆃 Pods in a StatefulSet are named sequentially 🆃 metadata:
🆃 labels:
(e.g., db-0, db-1, db-2) and maintain the same 🆃 app: mysql
🆃 minikube ip
🆃 curl http://$(minikube ip):30050
🆃 kubectl get svc -A
🆃 minikube
status/stop/start/dashboard
🆃 minikube service nginx-service --url
Thank You!! :)