Controllers
-
Replica Set:
- Much like Replication Controller
- Replica Set can be preserved and revisited
-
Stateful Sets: For easier understanding,
- Stateful Sets are much like Replication Controllers with persistent storage
- note: This definition is not 100% right, but its ok for now
-
Jobs & Cron Jobs:
- Job/Cron Job speaks about specification which will run some application/script/code which will execute and finish
-
Note:
- Like any other k8s object, Controllers also have
- Specification
- Status
- Here the Specification is more about controlling the objects/workloads.
- Can define workload
- how to manage the workload
- Like any other k8s object, Controllers also have
Service
-
Consider this Scenario, where we have app server and db server
-
In this app server will communicate with db server to store/retrieve the data
-
Now due to application load you have scaled pods to 3
-
Now lets assume the node on which mysql pod is running has failed, In that case we get a new sql pod which has new ip address
-
In this case application stops working as db is not connected.
-
To Resolve this , K8s uses Service which is used for communicating to the database pod.
-
Now lets assume pod has failed and new mysql pod is created
-
When a service is created, in the specification label information has to be provided.
-
K8s service will forward traffic to the pods matching the labels given in the service spec
-
Service is a Layer-4 load balancer
-
In K8s layer-7 load balancing is supported by ingress.