Skip to content

fix(kubernetes): fail fast on cluster_name change for existing clusters - #13466

Open
mehrdadbn9 wants to merge 2 commits into
kubernetes-sigs:masterfrom
mehrdadbn9:fix/cluster-name-change-guard-13233
Open

fix(kubernetes): fail fast on cluster_name change for existing clusters#13466
mehrdadbn9 wants to merge 2 commits into
kubernetes-sigs:masterfrom
mehrdadbn9:fix/cluster-name-change-guard-13233

Conversation

@mehrdadbn9

Copy link
Copy Markdown
Contributor

What type of PR is this?

/kind bug

What this PR does / why we need it:

Changing cluster_name in inventory and re-running kubespray against an existing cluster silently invalidates the certificate issuer, the service-account JWT issuer and the identity the CNI plugin asserts, breaking authentication and pod networking cluster-wide (issue reporter lost calico + auth entirely).

This adds an early guard in kubeadm-setup.yml: when kubeadm has already run on the node and admin.conf is present, the cluster name kubeadm wrote into it is compared with the configured cluster_name, and the playbook fails fast with an actionable message instead of applying the change.

  • First installations are unaffected (guard runs only when kubeadm_already_run is true)
  • If admin.conf was moved/renamed by the operator, the guard skips rather than failing
  • Guard sits before backup/cert-generation tasks, so nothing destructive runs first

Which issue(s) this PR fixes:

Fixes #13233

Special notes for your reviewer:

Verified locally with ansible-playbook 2.16 against a stubbed config tree: mismatch fails with the message, match continues, missing admin.conf skips. Full-role ansible-playbook --syntax-check passes.

Fail fast with a clear error when cluster_name is changed on an existing cluster instead of silently disrupting certificates, JWT issuers and CNI authentication.

…balls

gvisor changed its release artifacts: the per-arch binary .sha512 files
under storage.googleapis.com/gvisor/releases/release/{version}/{arch}/
no longer exist for new releases, so the update-hashes script fails
with HTTP 404 and new gvisor versions cannot be added.

Since release-20260817.0, gvisor publishes GitHub releases containing
gvisor-{arch}.tar.bz2 archives plus SHA256SUMS and SHA512SUMS files.

- replace gvisor_runsc_binary and gvisor_containerd_shim_binary entries
  in component_hash_update with a single gvisor_archive entry pointing
  at the GitHub release SHA512SUMS file, with an extractor that maps
  the two tarball hashes to x86_64/aarch64
- collapse the two download definitions (gvisor_runsc,
  gvisor_containerd_shim) into one gvisor_archive download with
  unarchive enabled
- copy runsc and containerd-shim-runsc-v1 from the extracted gvisor/
  directory in the gvisor role
- add gvisor_archive_checksums for release-20260817.0 (amd64/arm64)

The old per-arch checksum variables remain as aliases so the checksum
data in vars/main/checksums.yml keeps resolving during the transition.

Fixes: kubernetes-sigs#13460
Signed-off-by: Mehrdad Biukian Naeini <mehrdadbiukian@gmail.com>
Changing cluster_name on an already-deployed cluster invalidates the
certificate issuer, the JWT token issuer used by the API server and the
identity asserted to the CNI plugin, which breaks pod networking and
authentication cluster-wide without any warning from kubespray.

Add an early guard in kubeadm-setup.yml: when kubeadm has already run on
the node and admin.conf is present, extract the cluster name that kubeadm
wrote into it and fail with an actionable message if it differs from the
configured cluster_name. First installations never reach the guard
(kubeadm_already_run is false), and if admin.conf was moved away the
guard skips instead of failing.

Fixes: kubernetes-sigs#13233
Signed-off-by: Mehrdad Biukian Naeini <mehrdadbiukian@gmail.com>
@kubernetes-prow kubernetes-prow Bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/bug Categorizes issue or PR as related to a bug. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Sep 4, 2026
@kubernetes-prow

Copy link
Copy Markdown
Contributor

Hi @mehrdadbn9. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work.

Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@kubernetes-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: mehrdadbn9
Once this PR has been reviewed and has the lgtm label, please assign mzaian for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kubernetes-prow kubernetes-prow Bot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Sep 4, 2026
@kubernetes-prow
kubernetes-prow Bot requested review from guoard and yankay September 4, 2026 05:59
@guoard

guoard commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

There is a reson why previous attempt stopped or failed(maybe?): #13242 (comment)

Also the files changed in this PR have changes from #13465.

@guoard

guoard commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Also, please don't just dump an issue number into an AI tool and ask it to write a fix. It's really important to manually read the issue, investigate the related files, and properly test the changes yourself.

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

Labels

cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Changing cluster_name via Kubespray causes cluster-wide disruption without validation or graceful failure

2 participants