Kubernetes
Production-grade container orchestration.

Components


Control plane
- etcd: distributed persistent storage (key/value)
- api server
- scheduler: in charge of placing different resources on different servers
- controller manager: manage controllers
- cloud controller manager: ensure the interactions with the cloud provider APIs
Worker nodes
- kubelet: in charge of creating and managing pods
- kubernetes proxy: redirection management
- container runtime: containers management
Architecture

Liveness vs Readiness
- a
livenesswill provoke a container reboot - checks performed by the
livenessprobe: memory issue, dead lock, … - checks performed by the
readinessprobe: check db connection, check external service connection, …
---
apiVersion: apps/v1
kind: ReplicaSet
metadata:
name: whoami
spec:
replicas: 2
selector:
matchLabels:
app: whoami
level: expert
template:
metadata:
labels:
app: whoami
level: expert
spec:
containers:
- name: whoami
image: containous/whoami:latest
ports:
- name: main-port
containerPort: 80
readinessProbe:
httpGet:
path: /health
port: 80Best practices
- use kubernetes deployment
- configure probes
Startup,ReadinessandLiveness - use
Init containers - think twice before having kubernetes pods with multiple containers
- always set the
ImagePullPolicy - always set the
RequestsandLimits - use
labelsandannotations - use kubernetes as soon as possible
- version your descriptors
References
- training: https://github.com/l-lin/study/tree/master/kubernetes
- Introduction to Kubernetes Workshop | PPT
- DevJam 2019 - Introduction to Kubernetes | PPT
- Tutorials | Kubernetes
- Get Started with Kubernetes Ultimate Hands-on Labs and Tutorials | kubelabs
- 70 Best Kubernetes Tutorials
- Deploying a Spring Boot microservice in Kubernetes using Helm charts | by José Rodríguez | Medium