☸️ReplicaSet
Describe about What is ReplicaSet ?
It is the component that replica the pod for availability and load balance .
CheatSheet Command
Get ReplicaSet :
kubectl get rsCreate ReplicaSet:
kubectl apply -f <file_name>.yaml
apiVersion: apps/v1
kind: ReplicaSet
metadata:
  name: <replica_name>
spec:
  replicas: <numbers of replicas>
  selector:
    matchLabels:
      # this label need to match pod label for link
      <key_name>: xxx (1)      
  # this below come from Pods template    
  template:
    metadata:
      labels:
        <key_name>: xxx (2)
    spec:
      containers:
      - name: <pod_name>
        image: <image_name>
Describe information of ReplicaSet:
kubectl describe rs <replicaset_name>Delete ReplicaSet:
kubectl delete rs <replicaset_name>Edit ReplicaSet:
kubeclt edit rs <replicaset_name>after use this command you need to remove existing pod manually to let it recreateCheck the apiVersion of the template:
kubectl explain rsExecute command from file
kubectl apply -f <file_name>.yamlScale Pod by ReplicaSet:
kubectl scale rs --replicas=<amount_of_pod> <replicaset_name>(It will down or create new pod automatically)
Last updated