Introduction
Features
High availability, no downtime
Scalability
Diaster recovery
Architecture
One Master node
- 4 processes run on every master node
- API server, entry point to a k8s cluster, gatekeeper for authentication
- Controll manager, detect cluster state changes
- Scheduler, decide which node will host a new pod
- etcd, cluster brain, backing store
- Master processes
- Much more important
- Less resources
- Should have a backup
Multiple Worker nodes, do the actually work
- 3 processes must be installed on each worker node
- kubelet, interacts with both container and node, starts the pod with a container inside
- kube proxy, forwards the request from service to pod
- Container runtime, such as Docker
- Each node can have multiple pods
- Each pod can have multiple containers, though usually each pod has one container
- Higher workload
- Much bigger and more resources
Components
Node, virtual or physical machine
Pod
- Smallest unit in Kubernetes
- Abstraction over container
- One pod can run multiple containers, usually 1 application container per pod
- Each pod get its own internal IP address
- Pods are ephemeral, can die very easily
- If a pod dies, a new pod will be created with a new IP address
Service and Ingress
- Service is a permanent id address attached to a pod
- Lifecycle of Pod and Service not connected
- Specify the type of Service on creation
- Internal service is the default type
- Translate a URL to ip/port pair, the request goes to ingress, then is forwarded to service
Deployment and StatefulSet
- Blueprint for creating pods
- Deployment for stateless apps
- StatefullSet for stateful apps or database. Not easy on k8s, database is often hosted outside of k8s cluster
ConfigMap
- External configuration of your application
- Contains configuration data like urls of a database
- Kubernetes connects to pod, then pod gets the data that configMap contains
Secret
- Contains external configuration like configMap
- Used to store secret data, credentials, in base64 encode format
Volumes
- Storage on local machine, same node where pod is running
- Or remote, outside of K8s cluster
Deployment & StatefulSet
DaemonSet
Reference