ื—ืœืง 1 โ€” ื™ืฆื™ืจืช ืงื•ื‘ืฅ ReplicaSet

ื ื™ืฆื•ืจ ืงื•ื‘ืฅ ื—ื“ืฉ, ืœื“ื•ื’ืžื”:

touch nginx-rs.yaml

ื ื›ื ื™ืก ืืœื™ื• ืžื‘ื ื” ื‘ืกื™ืกื™:

apiVersion: apps/v1
kind: ReplicaSet
metadata:
  name: nginx-replicaset
spec:
  replicas: 3
  selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
        - name: nginx
          image: nginx

ืžื” ื—ืฉื•ื‘ ืœื”ื‘ื™ืŸ ื›ืืŸ?

๐Ÿ”น replicas: 3

ื–ื”ื• ืžืกืคืจ ื”-Pods ืฉืฆืจื™ื›ื™ื ืœืจื•ืฅ ื‘ื›ืœ ืจื’ืข.

ื–ื”ื• Source of Truth.

๐Ÿ”น selector.matchLabels

ื›ืš ื”-ReplicaSet ืžื–ื”ื” ืื™ืœื• Pods ืฉื™ื™ื›ื™ื ืืœื™ื•.

๐Ÿ”น template

ืžื’ื“ื™ืจ ืืช ื”-Pod ืฉื™ื™ื•ืฆืจ ื›ืืฉืจ ื—ืกืจื™ื replicas.

โš ๏ธ ื—ื™ื™ื‘ืช ืœื”ื™ื•ืช ื”ืชืืžื” ื‘ื™ืŸ ื”-label ื‘-template ืœื‘ื™ืŸ ื”-selector.


ื—ืœืง 2 โ€” ื™ืฆื™ืจืช ื”-ReplicaSet

ื ื—ื™ืœ ืืช ื”ืงื•ื‘ืฅ:

kubectl apply -f nginx-rs.yaml

ื ื‘ื“ื•ืง: