ReplicaSets

ReplicaSets deploy and maintain a defined number of Pods, all generated from a common template and a count. They're generally not created directly, instead created as part of a Deployment.

Definition

ReplicaSets comprise:

ReplicationControllers comprise:

  • A selector, which matches Pods.
  • A count of replicas defining the desired number of Pods.
  • A Pod template, used for creation of new Pods.

For example:

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

Backlinks