- Node is replicated to offer reliability
- if one node or pod inside node dies, users will still have access to pods inside another node
- It is seamless due to "ingress" and "service"
- Service works as a "Load balancer" between nodes
- ‼️A single service that has a static ip address, is used by all the same type of nodes in a cluster
- Example:
- Ingress → Service 1
- Service 1 → Node 1
- Service 1 → Node 2
- Service 1 → Node 3
- To create second "Replica" of Pod or "Node", we create "Deployments".
- Deployment (blueprint) contains all the necessary metadata to replicate a Pod/node
- ‼️ Database cannot be replicated via deployments
- This is because they have states!
- To manage their scalability, you will need:
- A persistant storage outside of node or your cluster (volumes)
- A manager, that tells which pods will be used for "writing" and which will be used for "reading" from the storage
- Read/write manager is required to limit data inconsistency
- To properly Replicate "Databases", there is a feature called "StatefulSet"
- It is meant for applications like databases
- This features makes sure "we" don't have to manage Read/Write ourselves so data is consistent!
- ⁉️ Deploying Databases using "StatefulSet" is NOT EASY
- Usually it is preferred to host databases outside of K8s cluster