What is ReplicaSet ? Create ReplicaSet !!



What is ReplicaSet ? Create ReplicaSet !!

What is ReplicaSet ? Create ReplicaSet !!

Learn AWS from the certified solution architect.

Kubernetes cluster on AWS – What is ReplicaSet ? Create ReplicaSet !!

This tutorial explains how to create Kubernetes Replicaset.

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.

A ReplicaSet is defined with fields, including a selector that specifies how to identify Pods it can acquire, a number of replicas indicating how many Pods it should be maintaining, and a pod template specifying the data of new Pods it should create to meet the number of replicas criteria. A ReplicaSet then fulfills its purpose by creating and deleting Pods as needed to reach the desired number. When a ReplicaSet needs to create new Pods, it uses its Pod template.

Kubernetes Documentation: https://kubernetes.io/

pod.yaml
========
apiVersion: v1
kind: Pod
metadata:
labels:
run: nginx
name: nginx
spec:
containers:
– image: nginx
name: nginx

rs.yaml
=======
apiVersion: apps/v1
kind: ReplicaSet
metadata:
name: demo-rs
labels:
dept: hr
spec:
replicas: 3
selector:
matchLabels:
env: demo
template:
metadata:
name: nginx
labels:
env: demo
spec:
containers:
– name: nginx
image: nginx