Skip to content

Latest commit

 

History

History
43 lines (35 loc) · 1000 Bytes

replicaset.md

File metadata and controls

43 lines (35 loc) · 1000 Bytes

Kubernetes ReplicaSet object

Kubernetes Documentation/Concepts/Workloads/Workload Resources/ReplicaSet

The ReplicaSet is a controller which deploys and restarts pods, declares to the container engine (Docker by default) to spawn or terminate a container until the requested number is running.

Command lines examples

# get all replicasets
kubectl get rs

# autoscale the replicaset
kubectl autoscale rs frontend --max=10 --min=3 --cpu-percent=50

# scale a replicaset named 'foo' to 3
kubectl scale --replicas=3 rs/foo

Manifest examples

apiVersion: apps/v1
kind: ReplicaSet
metadata:
  name: frontend
  labels:
    app: guestbook
    tier: frontend
spec:
  replicas: 3
  selector:
    matchLabels:
      tier: frontend
  template:
    metadata:
      labels:
        tier: frontend
    spec:
      containers:
      - name: php-redis
        image: gcr.io/google_samples/gb-frontend:v3