Kubernetes 101 : ReplicaSets and Stateless pods
We would create a replicaSet that would handle all these identical pod as a single set.
A replicaset uses labels to relate to "its" pods.
Pods and services:
The pods are accessed through an access point called a "service".
A service has an IP address and a port.
We create a replicaSet by sending the above Yaml for our replicaSet to the kubernetes API Server using the below command:
Managing the pods:
The replicaSet set will then make sure the number of the running pods with the label "debian" - as in our example -, matches the number of replicas "2", either by deleting the "surplus" pods with the label "debian" or creating new ones if the number of the "debian" pods is below "2".
We can check our pods using the below command:
We can get more detail about our replicaSet by running the below command:
Displaying pods related to a replicaSet:
We could check the pods that are managed by replicaSet using the below command, and looking at the annotations section of the pod:
We could also use the labels option to get the pods that match the selector of a replicaSet using the below command:
Comments