Kubernetes is one of the most important pillars of modern IT environments. However, working with Kubernetes continues to present companies with challenges - not least due to a rapidly growing ecosystem and complex application scenarios. With the full-day online conference Mastering Kubernetes, you will learn about the latest trends in container orchestration and how to use Kubernetes in practice. You will master the most important tools and techniques of the cloud-native world around Kubernetes!
1. Basic Understanding
2. Installation
3. Basic components
4. Advanced components
5. Example project
#Kubernetes #CloudComputing #Training #CICD #Docker #Networking
6. 1.1 Modern Infrastructure
VS
Monolithic
- Handle multiple related
tasks
- Compiling and testing the
entire platform
Microservices
- Smaller applications
deployed independently
- Encompass multiple
platforms
6
7. 1.2 Monolithic
Easy deployment
One executable file or directory makes
deployment easier.
Scalability
There is no easy way to scale individual
components.
Reliability
If there’s an error in any module, it could
affect the entire application’s availability.
Development
When an application is built with one
code base, it is easier to develop.
7
8. 1.3 Microservices
Multiple deployments
Teams need to add communication and
collaboration to coordinate deployments.
Flexible scaling
If reaches high load, new instances of
that service can rapidly be deployed.
High reliability
You can deploy changes for a specific
service, without the threat of bringing
down the entire application.
Development sprawl
It results in slower development speed
and poor operational performance.
8
17. 3.1 What is Kubernetes?
Kubernetes
It is pilot of a ship of
containers
For Applications
Focus on manage
applications, not
machines
Usage
For deployment,
scaling & management
of containers
Open Source
Open API container
orchestrator
Go
Fast robust, and written
in Google Go
Cloud
Supports multiple cloud
and bare-metal
environments
Mature
15 years of google
experience
17
18. 3.2 K8s Key Features
Rollouts & Rollbacks
Auto Scaling
Self Healing
Load Balancing
Storage Orchestrator
Secrets Management
18
19. 3.3 K8s High Level Architecture
API
Kubectl
Master01
Worker01
Worker02
Worker03
Worker04
Master02
19
Terminal
K8s Dashboard
20. 3.4 Master Node in K8s
API Server
It validates and configures pods,
services, replicationcontrollers...
01
Controller Manager
A daemon that embeds the core
control loops shipped with
Kubernetes
03
Scheduler
It finds feasible Nodes for a
container
02
etcd
A distributed key-value store used
to hold and manage the critical
information
04
Master Node 20
21. 3.5 Worker Node in K8s
Container Runtime
A software component that can
run containers on a host system
01
Kube proxy
A vital Kubernetes agent involves
in monitoring changes to network
03
Kubelet
A node-level agent that is in charge
of executing container requirement
02
Worker Node 21
22. 3.6 Typical Production Setup
Master 01
Master 02
Worker 01
Worker 02
Worker 03
22
How to setup locally???
35. Minikube Architecture
35
Host OS - 10.20.33.80
VM - 192.168.49.2
Container Runtime
Control Panel
Host OS Guest OS Minikube
X
Use GUI Instead
Guest OS - 192.168.33.80
37. 6.1 Pod
37
Pod as container
1. Smallest unit of K8s
2. Abstraction over container
3. Usually 1 application per Pod
4. Each Pod gets its own IP address
Node 1
38. 6.2 Deployment
38
Pod as Deployment
1. Blueprint for my-app pods
2. You create Deployments
Node 1
42. 6.6 Service
42
Pod 1
1. To group a set of Pod
endpoints into a single
resource
2. There are four types of
services that Kubernetes
supports:
a. ClusterIP
b. NodePort
c. LoadBalancer
d. Ingress
Node 1
Service
Pod 3
X
Pod 2
192.168.33.109 192.168.33.169 192.168.33.227
192.168.23.112
43. 6.7 MongoDB Service Example
43
apiVersion: v1
kind: Service
metadata:
name: mongodb-service
spec:
selector:
app: mongodb
ports:
- protocol: TCP
port: 27017
targetPort: 27017
44. 6.8 Layers of Abstraction
44
1. Container
2. Pod
3. ReplicaSet
4. Deployment
5. Service
45. 6.9 ConfigMap & Secret
45
my-app
1. External configuration
of your application
Node 1
my-app-service
db
db-service
db-service
user
password
57. 8.1 Possible Errors on Kubernetes
1. Insufficient Resource Allocation:
Error: Due to insufficient resource allocation, pods frequently crash or fail to start.
2. Problems with Network Configuration:
Error: Pods are unable to connect to external services or each other.
3. Image Pull Errors:
Error: Attempts by pods to retrieve container images from the registry are unsuccessful.
4. Incompatible Container Images:
Error: This error message indicates that incompatible container images are causing pods to fail or encounter runtime issues.
5. Incorrect Configuration:
Error: The fifth error is incorrect configuration, which results in unexpected behavior or failures.
6. Persistent Volume Problems:
Error: Issues pertaining to the storage of persistent volume claims (PVCs).
7. Errors in Pod Scheduling:
Error: Pods are not scheduled or are trapped in the pending stage.
8. Insufficient Health Checks:
Error: Neglecting to identify and manage unwell pods.
9. Inconsistent Deployments:
Error: Disparities exist between the intended and real deployment states.
10. Insufficient Logging and Monitoring:
Error: Difficulty in recognizing and diagnosing deployment difficulties due to inadequate logging and monitoring. 57
66. 8.10 Resource Utilization
66
mysql-0
Number of Replicas = Server number of cores / Pod number of cores
Example
Number of Replicas = 2 * 1000 / 500 = 4
mysql-1 mysql-2 mysql-3
memory: "50Mi"
cpu: "500m"
67. 8.11 Horizontal Pod AutoScaling (HPA)
67
mysql-0 mysql-1 mysql-2 mysql-3
memory: "50Mi"
cpu: "500m"
# Deploy an autoscaler
# Scale the deployment to 2
kubectl scale deploy/application-cpu --replicas2
# Deploy the autoscaler
kubectl autoscale deploy/application-cpu --cpu-percent=
95 --min=1 --max=10
# Get details about hpa
kubectl describe hpa/application-cpu
68. 8.12 Helm
1. Package manager for Kubernetes
2. The archive of yamls
3. Contains Charts.
4. Example Elastic stack for logging
5. helm search <keyword>
helm repo add <project name> <project url>
helm repo update
helm install <project name>
68
71. 8.15 Monitoring using Prometheus
71
Prometheus is a free software application used for event monitoring and alerting.
Three components:
1. Time series database for metrics data
2. Data retrieval worker
3. HTTP Server for Web UI, Grafana etc
Matrics Pull mechanism / scraping endpoint
Programming language: Go
Developer: SoundCloud, Cloud Native Computing Foundation
Prometheus operator available using Helm chart
Used by many companies including:
DigitalOcean, Ericsson, CoreOS, Weaveworks, Red Hat, and Google.
76. 76
Mastering Kubernetes
https://github.com/wajrcs-dk/mastering-kubernetes/blob/main/6-books/Mastering-Kubernetes.pdf
https://www.kgay4all.com/index.php?p=Books%2FKUBERNETES
Kubernetes Tutorial for Beginners
https://www.youtube.com/watch?v=X48VuDVv0do
Introduction to kubernetes with demo
https://www.slideshare.net/opsta/introduction-to-kubernetes-with-demo-236989184
k3s vs k8s: What's the difference?
https://www.youtube.com/watch?v=FmLna7tHDRc
Setup Prometheus Monitoring on Kubernetes using Helm and Prometheus Operator
https://www.youtube.com/watch?v=QoDqxm7ybLc
Persistent Volumes on Kubernetes for beginners
https://www.youtube.com/watch?v=ZxC6FwEc9WQ
Kubernetes cluster autoscaling for beginners
https://www.youtube.com/watch?v=jM36M39MA3I
Kubernetes Projects
https://ramitsurana.github.io/awesome-kubernetes/projects/projects/
10 Possible Errors on Kubernetes Deployments and Troubleshooting Steps
https://www.linkedin.com/pulse/10-possible-errors-kubernetes-deployments-steps-naveed-abdul-sattar/
How would you handle errors in a container?
https://www.reddit.com/r/docker/comments/109i28v/how_would_you_handle_errors_in_a_container/
13 Kubernetes Tools You Should Know in 2024
https://overcast.blog/13-kubernetes-tools-your-should-know-in-2024-4e857124c176
10. Reference
Waqar Alamgir
wajrcs@gmail.com
@wajrcs_dk
@wajrcs-dk