ReplicaSet — Kubernetes

Always learning
3 min readNov 6, 2023

--

A Kubernetes Deployment is used to tell Kubernetes how to create or modify instances of the pods that hold a containerized application.

Deployments can scale the number of replica pods, enable rollout of updated code in a controlled manner, or roll back to an earlier deployment version if necessary.

A ReplicaSet is a process that runs multiple instances of a Pod and keeps the specified number of Pods constant.

ReplicaSet ← Theory Part

Its purpose is to maintain the specified number of Pod instances running in a cluster at any given time to prevent users from losing access to their application when a Pod fails or is inaccessible.

A Replication Controller is a structure that enables you to easily create multiple pods, then make sure that that number of pods always exists. If a pod does crash, the Replication Controller replaces it.

First check any pods running on minikube

kubectl get pods

Kubernetes architecture only run

kubectl get all -A
Deploy → ReplicaSet → Pod

Create a deployment.yml file

apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment
labels:
app: nginx
spec:
replicas: 3
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:1.14.2
ports:
- containerPort: 80

Create a deployment.yml

kubectl apply -f deployment.yml

Check pods & replicaset

kubectl get pods
kubectl get rs --ReplicaSet

If you delete the pod automatically create a replica set

kubectl get pods -w

Check pods

kubectl get pods

First delete replicaset after pod delete

kubectl delete -f deployment.yml
kubectl get rs
kubectl get pods -w

Done ….

See the POD blog

--

--

Always learning
Always learning

Written by Always learning

கற்றுக் கொள்ளும் மாணவன்...

No responses yet