Day 03 ReplicaSet in EKS.

Day 03 ReplicaSet in EKS.

High availability and Scalability.

(1) What is ReplicaSet?

A ReplicaSet's purpose is to maintain a stable set of replica Pods running at any given time. As such, it is often used to guarantee the availability of a specified number of identical Pods.

(2) Creating ReplicaSet.

```
kubectl get replicaset
kubectl get rs
```

(3) Test the High availability of ReplicaSet.

  • The main feature of ReplicaSet is to maintain a stable set of replica Pods running at any given time.

  • It means if you define there should be at least 3 pods should be running at any point in time, In case of failure or error any pod(s) crash or fail to load. ReplicaSet will create new pod(s) and maintain the provided number 3 of running pods.

# Number of running pods
kubectl get pod

# Delete any running pod.
kubectl delete pod <pod-name>

# Check the numbers of pods running, you will find a newly created pod.
kubectl get pod

(4) Scalability in ReplicasSets.

  • In frontend.yaml file, key :replicas is indicate the number of pods.Currently, it sets as 3 you can change it to 5.
# Before
spec:
  replicas: 3

# After
spec:
  replicas: 5
  • Update the ReplicaSet
# Below command will again read the file and change the replicas.

kubectl apply -f frontend.yaml

# To check newly created pods.

kubectl get pods

Made with :heart: by Pratikkumar Panchal