Introduction to K8s
Features
- high availability
- Scalable solutions
- Disaster recovery
Basic k8 components: https://medium.com/@usvisen2000/navigating-kubernetes-a-beginners-roadmap-to-understanding-key-concepts-8362558c10b6
Config Map: External configuration of your application, can be attached to a pod. This is not meant for secrets such as credentials.
Secret: Similar to config map but can be used to store credentials (passwords, etc). Can be attached to a pod.
Config map and secret can be accessed inside the pod using env vars or properties file.
K8 doesn’t manage storage directly.
StatefulSet: Meant for replication of stateful application such as databases. Database reads and writes are synchronised. Generally, databases are hosted outside the K8s cluster as its quite difficult to deploy databases on K8s.
Architecture
Worker nodes is where the actual pods are deployed. Each worker node needs the following services to be deployed:
- container runtime
- Kubelet (responsible for starting containers in the node, gets the request from scheduler.)
- Kubeproxy
Master Nodes Responsible for controlling cluster state and managing worker nodes (scheduling pod deployments, etc). Has the following components:
- API server (cluster gateway, CRUD for pods, handles authentication/authorisation, cluster health)
- Scheduler (Responsible for scheduling new pods. Scheduler gets the request through the API server)
- Controller manager (Monitors nodes, detects cluster state changes and tries to recover the cluster state by making requests to scheduler to schedule new pods that crashed, etc)
- Etcd (key-value store of the cluster state. Cluster changes get stored here)
Master nodes generally require less CPU and MEM compared to worker nodes (application servers).