ReplicaSet
Problem
If a pod is running a web application and the pod goes down, then users won't be able to access the data.
Somone would need to log in and fix the problem, but this takes time.
ReplicaSet
If a pod crashes, it will create a new pod automatically with a health check.
A ReplicaSet can be used to scale the number of pods.
Example YAML
vim sampleReplicaSet.yaml
:
apiVersion: apps/v1
kind: ReplicaSet
metadata:
name: frontend
labels:
app: guestbook
tier: frontend
spec:
# modify replicas according to your case
replicas: 3
selector:
matchLabels:
tier: frontend
template:
metadata:
labels:
tier: frontend
spec:
containers:
- name: php-redis
image: gcr.io/google_samples/gb-frontend:v3
Commands
create replica:
update replica:
get replica:
get pods:
scale replicas:
edit live config:
delete replica: