Introducing a new way to review your PRs.

Read the announcement

replicatedhq / kurl

Production-grade, airgapped Kubernetes installer combining upstream k8s with overlays and popular components

View on GitHub

19 documents · Updated Nov 23, 2026

docs / cluster-capacity-and-connectivity

Cluster capacity and connectivity checks

Cluster capacity and connectivity checks give maintenance actions a view of whether every node can support the work. They discover nodes through Kubernetes, check storage and image readiness, and test node-to-node network reachability before an operation can cause service impact.

Readiness role

These checks support the cluster operations command group and the node network utility. They turn cluster state into either usable data, such as node names and free bytes, or a clear failure that stops a risky maintenance step. The broader host and cluster readiness model is described in Preflight and host readiness, while host-only rules are covered in Host preflight checks.

The checks use two kinds of evidence:

  • Kubernetes objects describe nodes, storage classes, storage resources, and workload status.
  • Short-lived jobs and pods run on the target nodes when the Kubernetes status does not give enough evidence.

Node discovery

Node discovery starts with the Kubernetes node list. Each later check uses that list as the set of cluster nodes unless the action has an explicit target or exclusion rule.

Node image evidence

The image check reports which nodes do not have one or more requested container images. It first uses the image names reported by each node. If that report is empty or appears capped, the check runs a discovery job on the node and reads the container runtime image list. Image names are normalized before comparison, so equivalent image references use the same match rule. A node appears once even when it lacks several requested images.

The command can focus on one node or omit selected nodes. A discovery-job error is logged as best effort, so callers must treat the result as evidence from the available checks rather than as a complete proof that every image is present.

References: pkg/…/nodes.go• L24-47 pkg/…/nodes.go• L49-115 pkg/…/nodes.go• L117-149 pkg/…/cluster_images.go• L15-50

Storage capacity

Storage capacity checks answer two related questions: how much space a storage class can use now, and whether a migration has enough room for the data it will move. The selected storage class can be named directly. If no name is given, the check uses the cluster's default storage class.

Storage provider capacity

The check chooses its capacity view from the storage class provisioner. OpenEBS reports space for each node. Rook reports available Ceph space for the selected pool after accounting for pool replication. Other provisioners are not assessed by this command.

The result can be a report of available space or a pass/fail threshold check. For OpenEBS, a cluster-wide threshold passes only when every checked node has enough space. A node-specific check passes only for the named node. This distinction matters when a maintenance action can schedule work on any node.

References: pkg/…/cluster_free_disk_space.go• L36-59 pkg/…/cluster_free_disk_space.go• L61-75 pkg/…/cluster_free_disk_space.go• L77-123 pkg/…/cluster_free_disk_space.go• L125-149 pkg/…/cluster_free_disk_space.go• L210-239

OpenEBS node space

OpenEBS capacity is measured on each node that can run the check. A temporary claim and job make the OpenEBS path active on that node. The job reads the mounted volume's free and used space and checks the node's mount information so the result identifies whether the storage path is on the root volume. Temporary claims are removed after the assessment.

The check rejects nodes marked as not ready, unreachable, unschedulable, without a network, out of service, or in a shutdown or initialization state. These conditions matter because a capacity result is not useful if the maintenance job cannot run on that node.

References: pkg/…/openebs_free_disk_space_getter.go• L34-49 pkg/…/openebs_free_disk_space_getter.go• L51-127 pkg/…/openebs_free_disk_space_getter.go• L130-181 pkg/…/openebs_free_disk_space_getter.go• L184-323 pkg/…/openebs_free_disk_space_getter.go• L326-393

Rook Ceph space

Rook capacity is derived from the destination storage class and its Ceph pool. The check reads the pool replication setting and the Ceph cluster's available bytes, then treats the replicated pool's usable space as the available capacity for the migration. Missing pool or cluster state makes the check fail instead of producing an uncertain result.

References: pkg/…/rook_free_disk_space_getter.go• L18-41 pkg/…/rook_free_disk_space_getter.go• L44-73

Migration space reservation

The volume migration precheck compares destination capacity with the space reserved by volumes in the source storage class. For OpenEBS, it checks each node against the data expected to move there. It keeps a 15 percent reserve when the OpenEBS path is on the root volume to reduce the risk of disk-pressure eviction. Detached volume reservations must fit on every possible destination node because their final placement is not known.

For Rook, the precheck sums reservations from attached and detached volumes and compares the total with usable Ceph space. If the destination storage class cannot be identified, the migration tool skips this capacity check rather than guessing the provider.

References: pkg/…/openebs_disk_space_validator.go• L15-33 pkg/…/openebs_disk_space_validator.go• L35-112 pkg/…/rook_disk_space_validator.go• L20-61 kurl_util/…/main.go• L104-168

Node connectivity

Node connectivity validation checks the network path between every pair of different cluster nodes. It uses the node's network so the result tests the path that cluster traffic needs, not only a connection from the operator's host.

Reachability test

The connectivity command requires a port and accepts TCP or UDP. It places a listener on each node, then starts a short-lived pinger from each listener pod toward every other node's internal address. A unique value in the listener output confirms that the intended packet reached the intended node. UDP can use repeated attempts because delivery is not guaranteed.

The command removes its listener DaemonSet and pinger jobs after the test. A listener rollout failure can indicate that the chosen port is already in use. A failed pair reports the source node, destination node, port, and protocol so an operator can inspect network policy or node network rules.

References: pkg/…/nodes_connectivity.go• L73-152 pkg/…/nodes_connectivity.go• L192-232 pkg/…/nodes_connectivity.go• L319-365 pkg/…/nodes_connectivity.go• L368-390 pkg/…/nodes_connectivity.go• L406-460

Maintenance decision flow

Maintenance actions use these checks as gates around work that needs stable node and storage conditions. The following flow shows the common relationship between discovery, evidence gathering, and the final decision.

flowchart TD
    A[Maintenance action] --> B[Discover cluster nodes]
    B --> C{Required evidence}
    C -->|Images| D[Check image presence on nodes]
    C -->|Storage| E[Assess provider capacity]
    C -->|Network| F[Test node-to-node reachability]
    D --> G{Check passes}
    E --> G
    F --> G
    G -->|Yes| H[Continue maintenance work]
    G -->|No| I[Stop and report affected nodes or resource]

Storage migration adds a separate readiness gate for cluster size and operator readiness. The migration command first checks its current status, asks the storage operator whether the cluster meets its node requirement, and waits for the operator to report readiness before approval. It then waits for completion and reports operator logs if the migration fails.

References: pkg/…/cluster_migrate_multinode_storage.go• L99-137 pkg/…/cluster_migrate_multinode_storage.go• L204-273 kurl_util/…/main.go• L78-100

Change checklist

When these files or sections are changed, remember to consider these:

  • Keep the storage-class provisioner mapping aligned between the CLI capacity command and the migration capacity precheck. A new provider can otherwise report capacity in one path and silently skip it in another.
  • Preserve the image-reference normalization rule across node status data and runtime job output. A change can mark the same image as missing when it is written with a different valid reference.
  • Keep node filters consistent between the CLI flags and the node discovery result. Target and excluded nodes affect both the reported set and the meaning of a successful threshold check.
  • Keep connectivity listener and pinger cleanup aligned with the selected namespace, image, protocol, and port. Stale test resources can affect later checks or leave a port occupied.
  • Keep storage migration reservation rules aligned with the capacity measurement. Root-volume reserve handling and detached-volume placement assumptions change whether a migration can safely start.

Important failure modes

TriggerConsequenceGuard
A storage class has no default when the command does not name oneCapacity assessment cannot select a storage targetRequire an explicit storage class or define one default class
An OpenEBS node is not schedulable or does not report usable df dataThe node's capacity cannot support a reliable checkRestore node readiness and scheduling, then rerun the assessment
Ceph pool or cluster status is missingRook capacity cannot be calculatedRepair the Rook resource state before migration
A requested image is absent from a nodeA workload or maintenance job may fail when scheduled thereMake the image available on the affected node or change the node set
A listener DaemonSet cannot roll out or a packet is not confirmedAt least one node-to-node path may be blocked or the test port may be unavailableCheck port use, network policy, and node network rules
Destination capacity is below source volume reservationsStorage migration can run out of spaceFree capacity or reduce the data to move before starting

Key files

FileWhy to read it
pkg/…/cluster.goDefines the cluster operations command group.
pkg/…/commands.goShows where cluster capacity, image, migration, and connectivity commands enter the CLI.
pkg/…/cluster_images.goDefines the user-facing node image check.
pkg/…/nodes.goExplains node discovery and the two sources of image evidence.
pkg/…/cluster_free_disk_space.goDefines storage-class selection and the capacity command's provider-specific decisions.
pkg/…/openebs_free_disk_space_getter.goShows how OpenEBS space is assessed per node.
pkg/…/rook_free_disk_space_getter.goShows how usable Rook Ceph space is derived.
pkg/…/openebs_disk_space_validator.goShows the per-node migration reservation check for OpenEBS.
pkg/…/rook_disk_space_validator.goShows the aggregate migration reservation check for Rook.
pkg/…/nodes_connectivity.goDefines the full node-to-node network test and cleanup behavior.
kurl_util/…/main.goShows how migration invokes provider-specific free-space checks before volume movement.