Skip to content

4.9. ReplicaSets

Overview

The ReplicaSets page shows every ReplicaSet in the multi-cluster environment in one place. A ReplicaSet is the Kubernetes resource that guarantees a given number of pod replicas is always maintained.

What it is for:

  • Viewing multi-cluster ReplicaSets together
  • Monitoring ReplicaSet state per cluster
  • Adjusting the replica count dynamically (scaling up and down)
  • Checking the pods of a ReplicaSet

What a ReplicaSet is like:

  • Created and managed automatically by a Deployment
  • Maintains the given replica count
  • Creates pods from the pod template
  • Manages pods through a selector

Note: a ReplicaSet is normally managed automatically by a Deployment. Using a Deployment is recommended over creating a ReplicaSet directly.

How the Screen Is Laid Out

The ReplicaSets page shows the ReplicaSet list as a table. This resource is of the Managed type, so it shows the resources that exist on the member clusters.

The ReplicaSets main screen

The Elements at the Top of the Page

ElementDescription
Cluster filterShows only the ReplicaSets of a particular cluster
Namespace filterShows only the ReplicaSets of a particular namespace
Refresh buttonRefreshes the ReplicaSet list
Search boxSearches by ReplicaSet name

Table Columns

ColumnDescriptionSortable
NameThe ReplicaSet name
NamespaceThe namespace the ReplicaSet belongs to
ClusterThe cluster the ReplicaSet exists on
StatusThe replica state (ready / desired) and the failed count
ImageThe container image
SelectorThe pod selector labels
AgeThe time since the ReplicaSet was created
ActionsThe view and delete buttons-

How Status Is Shown

The Status column shows the ReplicaSet's replicas:

StatusDescriptionHow it is shown
HealthyEvery replica is readyGreen (1/1, for example)
In progressSome replicas are still getting readyYellow (0/1, for example)
FailedPod creation failedA red badge (1 failed, for example)
InactiveNo replicasGrey (0/0, for example)

For example 0/1 1 failed -- 0 of 1 desired replicas ready, 1 failed.

ReplicaSet Detail

Clicking a ReplicaSet row opens the detail panel.

ReplicaSet detail

The Detail Panel Header

ElementDescription
ReplicaSet nameThe name of the chosen ReplicaSet
Managed badgeMarks it as a member cluster resource
NamespaceThe namespace the ReplicaSet belongs to
ClusterThe cluster the ReplicaSet exists on
Replica stateReady replicas / desired replicas (1/1, for example)

The Action Buttons

ButtonWhat it does
Scale DownLowers the replica count
Scale UpRaises the replica count
RefreshRefreshes the ReplicaSet information
ViewOpens the YAML view mode
DeleteDeletes the ReplicaSet

The Tabs

The Overview Tab

Shows the ReplicaSet's basic information, replica state, pod state, and container images.

Basic information:

ItemDescription
NameThe ReplicaSet name
NamespaceThe namespace the ReplicaSet belongs to
ClusterThe cluster the ReplicaSet exists on
StatusThe replica state (1/1 ready, for example)
AgeThe time since creation
CreatedWhen the ReplicaSet was created

Replica state:

Shows the replica state visually, with a progress bar:

ItemDescription
Desired ReplicasThe target replica count
Ready ReplicasThe number of replicas that are ready
Available ReplicasThe number of replicas that are available
Fully Labeled ReplicasThe number of replicas carrying every label

Pod state:

Shows the current pods by state:

  • Running: the number of pods running normally
  • Pending: the number of pods waiting to be scheduled
  • Failed: the number of pods that failed

Container images:

Shows the container images defined on the ReplicaSet. The copy button copies the image URL to the clipboard.

The Labels Tab

Shows the list of Kubernetes labels applied to the ReplicaSet.

The Annotations Tab

Shows the list of annotations applied to the ReplicaSet.

The Pods Tab

Shows the list of pods that ReplicaSet manages.

The Pods tab
ColumnDescription
NameThe pod name
ClusterThe cluster the pod is running on
StatusThe pod state (Running / Pending / Failed)
NodeThe node the pod is scheduled on
RestartsThe pod restart count
AgeThe time since the pod was created
ActionsThe view and delete buttons

The Events Tab

Shows the Kubernetes events related to the ReplicaSet.

ReplicaSet Operations

Scaling Up and Down

  1. Choose the ReplicaSet
  2. Press the scale up (+) or scale down (-) button in the detail panel
  3. Confirm the replica count has changed

Caution: changing the replica count of a ReplicaSet managed by a Deployment directly may see the Deployment put it back. Changing the Deployment's replica count is recommended.

Viewing the ReplicaSet YAML

  1. Choose the ReplicaSet
  2. Press the "View" button in the detail panel
  3. Read the ReplicaSet definition in the YAML viewer

Deleting a ReplicaSet

⚠️ Caution: deleting a ReplicaSet deletes every pod that belongs to it. A ReplicaSet managed by a Deployment is recreated automatically.

  1. Choose the ReplicaSet to delete
  2. Press the "Delete" button in the detail panel
  3. Type the ReplicaSet name in the confirmation dialog
  4. Press the "Delete" button

Worked Examples

Scenario 1: Checking ReplicaSet Status

  1. Click the ReplicaSet you want to check on the ReplicaSets page
  2. Check the replica state on the Overview tab:
    • Take in the overall state from the progress bar
    • Compare desired replicas against ready replicas
  3. Check the detail in the pod state section
  4. Where there is a problem, find the cause on the Events tab

Scenario 2: Viewing ReplicaSets per Cluster

  1. Click the cluster filter dropdown
  2. Choose the cluster to check
  3. Only that cluster's ReplicaSets are shown
  4. Add the namespace filter as well if needed

Scenario 3: Resolving a Failed ReplicaSet

  1. Click the ReplicaSet showing "failed" in the Status column
  2. Check the pod state on the Overview tab:
    • Check the failed pod count
  3. Identify the failed pod on the Pods tab
  4. Click the pod for its detail
  5. Find the cause of failure on the Events tab
  6. Change the Deployment or the image settings if needed

Scenario 4: Checking a ReplicaSet's Pods

  1. Click the ReplicaSet whose pods you want to check
  2. Choose the Pods tab
  3. Check the status, node, and restart count in the pod list
  4. Click an individual pod for its detail
  5. Check the pod logs if needed

Scenario 5: Adjusting the Replica Count

  1. Choose the ReplicaSet to adjust
  2. Press the scale up or scale down button in the detail panel
  3. Check the change in the replica state
  4. Watch the new pods being created or deleted on the Pods tab

ReplicaSet against Deployment

TraitReplicaSetDeployment
RoleMaintains the replica countManages ReplicaSets and rollouts
UpdatesUpdated by handSupports rolling updates
RollbackNot supportedSupports automatic rollback
Recommended useUsing it directly is not recommendedThe standard way to deploy
HistoryNoneKeeps a revision history

How a ReplicaSet Works

  1. Selector matching: the ReplicaSet manages the pods that match its selector
  2. Maintaining replicas: it compares the desired replica count against the actual pod count
  3. Creating and deleting pods: where they differ, it creates or deletes pods
  4. Continuous watching: it keeps monitoring the pod state

The Pod Template Hash

The hash in a ReplicaSet name (my-deployment-69459b88fc, for example):

  • Generated by the Deployment from the contents of the pod template
  • A change to the template creates a new ReplicaSet with a new hash
  • The previous ReplicaSet is kept at 0 replicas (for rollback)

The Selector

The labels by which a ReplicaSet identifies the pods it manages:

selector:
matchLabels:
app: my-app
pod-template-hash: 69459b88fc
  • app: the label identifying the application
  • pod-template-hash: the hash the Deployment generates

The Replica State Fields

FieldDescription
replicasThe current pod count
readyReplicasThe number of pods that are Ready
availableReplicasThe number of pods that are available
fullyLabeledReplicasThe number of pods carrying every label

Managed Resources

A ReplicaSet is a Managed resource:

  • A resource that exists directly on a member cluster
  • It can only be viewed from the MCM control plane
  • The cluster filter shows a particular cluster's resources
  • It is managed per cluster directly, not through a PropagationPolicy

Resolving Problems

When no pod is created:

  • Check whether the image pull failed (the image name, registry authentication)
  • Check whether resources are short (the CPU and memory limits)
  • Check the node selector or affinity settings

When the replica count differs from what you want:

  • Check the scheduler has a node to place the pod on
  • Check the PersistentVolumeClaim binding state
  • Check the resource quota limits

Next Steps