The document provides a comprehensive overview of Kubernetes, covering its architecture, container orchestration, internal and external routing, configuration and credentials management, persistent storage, update processes, autoscaling, and package management using Helm. Key concepts include Pods, Replica Sets, Deployments, Services, and Ingress Controllers, each detailed with example configurations. It also includes references for further reading on Kubernetes and Helm documentation.
Pods
● A podis a group of containers that
share the file system, users, network
interfaces, etc
● By default a pod will include two
containers: one for the given docker
image and other for the network
interface
C1 C2 Cn
apiVersion: v1
kind: Pod
metadata:
name: myapp-pod
labels:
app: myapp
spec:
containers:
- name: myapp-container
image: busybox
command: ['sh', '-c', 'echo
Hello Kubernetes! && sleep 3600']
9.
Replica Sets
● ReplicaSets are used for
orchestrating pods
● They define the docker images,
resources, env. variables, ports,
etc required for creating pods
apiVersion: apps/v1
kind: ReplicaSet
metadata:
name: frontend
labels:
app: guestbook
spec:
replicas: 3
selector:
matchLabels:
tier: frontend
matchExpressions:
- {key: tier, operator: In}
template:
metadata:
labels:
...
spec:
containers:
- name: php-redis
image: foo:bar
ports:
- containerPort: 80
Replica Set
C1 C2
10.
Deployments
● A deploymentis used for
orchestrating pods via replica sets:
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment
spec:
replicas: 3
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:1.7.9
ports:
- containerPort: 80
Replica Set
Deployment
C1 C2
Ingresses
Replica Set
Deployment
Service
Ingress
apiVersion: extensions/v1beta1
kind:Ingress
metadata:
name: test-ingress
annotations:
nginx.ingress.kubernetes.io/rewri
te-target: /
spec:
rules:
- http:
paths:
- path: /testpath
backend:
serviceName: test
servicePort: 80
● An ingress is used for configuring a
load balancer for external routing
C1 C2
Horizontal Pod Autoscalers
ReplicaSet
Deployment
Service
● Enable autoscaling for pods based on CPU utilization
Horizontal Pod
Autoscaler
Resource Metrics API
C1 C2
Helm
● Helm isthe Kubernetes package manager.
● It uses Charts for defining, installing and upgrading
applications on Kubernetes.
● Runtime configurations can be templated and
parameterized.
● Existing Charts can be reused and added as dependencies to
new Charts.
● Helm is managed by CNCF.
https://docs.helm.sh
References
● Kubernetes Documentation:
○https://kubernetes.io/docs/
● An Introduction to Kubernetes:
○ https://www.slideshare.net/imesh/an-introduction-to-kubernetes
● WSO2Con US 2015 Kubernetes: a platform for automating deployment,
scaling, and operations:
○ https://www.slideshare.net/BrianGrant11/wso2con-us-2015-kube
rnetes-a-platform-for-automating-deployment-scaling-and-operati
ons
● Kubernetes: An Overview:
○ https://thenewstack.io/kubernetes-an-overview/