Skip to content

CKS: refuse or fail fast when etcd nodes cannot get etcd from the Kubernetes ISO - #14706

Draft
andrijapanicsb wants to merge 3 commits into
apache:mainfrom
andrijapanicsb:cks-etcd-iso-check
Draft

andrijapanicsb wants to merge 3 commits into
apache:mainfrom
andrijapanicsb:cks-etcd-iso-check

Conversation

@andrijapanicsb

Copy link
Copy Markdown
Contributor

Description

In short: a Kubernetes cluster with dedicated etcd nodes is now refused straight away when the Kubernetes ISO has no etcd in it. If something still goes wrong with etcd on a node, the cluster fails in minutes with the reason, not after an hour with none.

Fixes: #14703

Why it matters

An operator registers a Kubernetes version from an ISO built without the optional etcd version (the ISO build script only adds etcd when asked). A user then creates a cluster with one or more etcd nodes. Today the request is accepted, the etcd nodes boot, find no etcd on the ISO and quietly do nothing. The cluster sits in Starting for the full one hour start timeout and then fails with no hint about the cause.

What changes for the user

Situation Before With this PR
Cluster with etcd nodes, ISO has no etcd Accepted, Starting for an hour, no reason Rejected at once; the message names the version and the missing file
Same, but the ISO could not be checked (storage VM down, direct download ISO) Starting for an hour Accepted; cluster goes to Error in about 10 minutes with the reason
ISO has etcd, but etcd does not start on a node Starting for an hour, no reason Error in about 10 minutes: etcd is not running on etcd node X, and why
Cluster without etcd nodes Works Unchanged, no check is done
ISO registered before the upgrade n/a Checked in the background shortly after the management server starts, or at the first request with etcd nodes

How it works

Two parts, one commit each.

1. Refuse up front. The secondary storage VM (the system VM that serves templates and ISOs) can now be asked whether an ISO contains a given file. The answer for the etcd archive is saved with the ISO, so each ISO is looked at only once. A background task looks at Kubernetes ISOs that have no answer yet. If there is still no answer when a cluster with etcd nodes is requested, the check runs right then. When the check cannot run, the request is allowed as before; this never blocks a cluster that would have worked.

2. Fail fast. The etcd node setup script stops when the etcd archive is missing or broken and writes down why. During cluster start, the management server checks over SSH that etcd is running on every etcd node, within a bounded wait. If not, the cluster goes to Error with the reason.

Details

Part 1

  • New CheckFileInIsoCommand / CheckFileInIsoAnswer. NfsSecondaryStorageResource lists the ISO with isoinfo -R -f -i <iso> (no mount) and looks for the path.
  • Result saved as template detail cks.etcd.included = true / false for etcd/etcd-linux-amd64.tar.gz. No detail means "not checked yet".
  • KubernetesVersionManagerImpl runs a background check every 5 minutes for Ready Kubernetes ISOs without the detail; it stops trying an ISO after 3 failed background checks (the check at request time still runs).
  • createKubernetesCluster with etcdnodes > 0: true goes ahead, false throws InvalidParameterValueException, unknown runs the check once and acts on it, and a check that cannot run lets the request through.
  • listKubernetesSupportedVersions returns supportsetcd once the ISO has been checked. The create cluster form shows a warning when etcd nodes are set and the selected version has supportsetcd = false.

Part 2

  • etcd-node.yml: on a missing or broken archive, or when the ISO never shows up, the script writes the reason to /home/cloud/etcd-setup-failed and exits non-zero. systemctl enable --now etcd only runs when the setup worked.
  • KubernetesClusterStartWorker.verifyEtcdRunningOnEtcdNodes runs right after the ISO is attached. etcd has to be seen active on two checks in a row, so a service that keeps restarting does not pass.
  • New dynamic global setting cloud.kubernetes.etcd.node.setup.timeout, default 600 seconds. The wait never goes past the cluster start timeout.
  • On failure the ISO is detached from the VMs and the cluster goes to Error (CreateFailed).

Types of changes

  • Breaking change (fix or feature that would cause existing functionality to change)
  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (improves an existing feature and functionality)
  • Cleanup (Code refactoring and cleanup, that may add test cases)
  • Build/CI
  • Test (unit or integration test code)

Feature/Enhancement Scale or Bug Severity

Bug Severity

  • BLOCKER
  • Critical
  • Major
  • Minor
  • Trivial

Screenshots (if appropriate):

None yet.

How Has This Been Tested?

Draft: unit tests only so far. A live run is planned on an environment built from this PR's packages.

What Result
Build of the Kubernetes plugin, the secondary storage module and what they depend on, with checkstyle Passed
Kubernetes plugin unit tests, 4 classes, 81 tests (29 new) All passed
Secondary storage unit tests, 31 tests (8 new) 30 passed, including the 8 new ones
The 1 failure, testExecuteQuerySnapshotZoneCopyCommand Not from this change: an existing test that fails on a Windows build machine because of the path separator

Not verified yet:

  • The ISO listing on a real secondary storage VM.
  • The SSH check against live etcd nodes on isolated, VPC and shared networks.
  • The UI warning in a running UI.
  • The case from the issue end to end (Kubernetes ISO without etcd plus one etcd node, and an ISO with etcd as the control).

How did you try to break this feature and the system with this change?

In unit tests: ISO missing on storage, non-NFS store, isoinfo failing, direct download ISO, no storage VM endpoint, an answer from an older agent that does not know the command, etcd that flips between running and stopped, an etcd node that cannot be reached over SSH, and a setup timeout longer than the cluster start timeout. In all cases where the ISO cannot be checked the request is let through, so an upgrade cannot start refusing clusters that worked before.

A cluster with dedicated etcd nodes was accepted even when the ISO of
the chosen Kubernetes version did not include the etcd binaries. The
etcd nodes then never came up and the cluster sat in Starting until
the one hour start timeout.

The secondary storage VM can now be asked whether an ISO contains a
given file. The result for etcd/etcd-linux-amd64.tar.gz is saved as
the ISO detail cks.etcd.included, so each ISO is checked only once.
A background task checks the Kubernetes ISOs that have no result yet,
which also covers ISOs registered before an upgrade. If there is still
no result when a cluster with etcd nodes is requested, the check runs
at that point.

createKubernetesCluster with etcd nodes is rejected with a clear
message when the ISO has no etcd. When the ISO cannot be checked, for
example because the storage VM is down or the ISO is direct download,
the request is allowed as before.

listKubernetesSupportedVersions returns supportsetcd, and the UI shows
a warning when etcd nodes are asked for with a version that lacks etcd.

Fixes apache#14703
When etcd could not be set up on a dedicated etcd node, nothing
noticed. The cluster stayed in Starting until the one hour start
timeout and no reason was given.

The etcd node setup script now stops when the etcd archive is missing
or broken, or when the Kubernetes ISO never shows up, and writes the
reason to /home/cloud/etcd-setup-failed. etcd is only started when the
setup worked.

After the ISO is attached, the management server checks over SSH that
etcd is running on every etcd node. etcd has to be seen running on two
checks in a row, so a service that keeps restarting does not pass. If
a node reports a failure, or etcd is not running within
cloud.kubernetes.etcd.node.setup.timeout (default 600 seconds), the
cluster goes to Error with the reason.

Related to apache#14703
@codecov

codecov Bot commented Nov 15, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 3.86%. Comparing base (c5bd11a) to head (b275f0b).

❗ There is a different number of reports uploaded between BASE (c5bd11a) and HEAD (b275f0b). Click for more details.

HEAD has 1 upload less than BASE
Flag BASE (c5bd11a) HEAD (b275f0b)
unittests 1 0
Additional details and impacted files
@@              Coverage Diff              @@
##               main   #14706       +/-   ##
=============================================
- Coverage     20.77%    3.86%   -16.92%     
=============================================
  Files          6053      494     -5559     
  Lines        548230    42875   -505355     
  Branches      73237     8136    -65101     
=============================================
- Hits         113903     1657   -112246     
+ Misses       420988    40986   -380002     
+ Partials      13339      232    -13107     
Flag Coverage Δ
uitests 3.86% <ø> (ø)
unittests ?

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

When a cluster with etcd nodes is requested and the ISO has not been
checked yet, read the copy of the ISO in the zone the cluster is
deployed into. Before this, any copy that was ready could be read,
also one in another zone.

If the copy in that zone cannot be checked, the request is allowed as
before and the check during cluster start catches a failed etcd setup.

The background task is not tied to a zone and still reads any copy
that is ready.

Related to apache#14703
@andrijapanicsb

Copy link
Copy Markdown
Contributor Author

@ACSHomeBot package G

@ACSHomeBot

ACSHomeBot commented Nov 15, 2026 •

Copy link
Copy Markdown

Accepted: package kvm G for b275f0b1f12e.

Planned: RPM + DEB, KVM SystemVM.

Status: Failed.

Packaging results:

Result Artifact Platform Build Time
FAIL RPM EL (EL8/9/10) 16 min
NOT RUN DEB Ubuntu, Debian n/a

No public repository was promoted.

Status: Package building failed.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CKS: cluster with dedicated etcd nodes hangs in Starting for an hour when the Kubernetes ISO has no etcd binaries

2 participants