Skip to content

fix(deployment): default k3s image and --k3s-image argument in deploy.py#6151

Merged
tombch merged 6 commits into
mainfrom
k3s-image-arg
Mar 20, 2026
Merged

fix(deployment): default k3s image and --k3s-image argument in deploy.py#6151
tombch merged 6 commits into
mainfrom
k3s-image-arg

Conversation

@tombch

@tombch tombch commented Mar 18, 2026

Copy link
Copy Markdown
Collaborator

I encountered an issue running ./deploy.py cluster --dev and ./deploy.py helm --dev as-is. When running ./deploy.py helm --dev, I would get:

Error: INSTALLATION FAILED: unable to build kubernetes objects from release manifest: [resource mapping not found for name: "compression-middleware" namespace: "" from "": no matches for kind "Middleware" in version "traefik.containo.us/v1alpha1"
ensure CRDs are installed first, resource mapping not found for name: "redirect-middleware" namespace: "" from "": no matches for kind "Middleware" in version "traefik.containo.us/v1alpha1"
ensure CRDs are installed first, resource mapping not found for name: "redirect-www-middleware" namespace: "" from "": no matches for kind "Middleware" in version "traefik.containo.us/v1alpha1"
ensure CRDs are installed first, resource mapping not found for name: "cors-all-origins" namespace: "" from "": no matches for kind "Middleware" in version "traefik.containo.us/v1alpha1"
...

It turns out this was because the k3d cluster create command does not specify the k3s image, and was installing a version of k3s that uses traefik v3 rather than v2. K3s version 1.32 and above installs traefik v3 by default: https://docs.k3s.io/upgrades#version-specific-caveats .

This PR adds a --k3s-image argument for deploy.py cluster, with the image defaulting to rancher/k3s:v1.31.14-k3s1 which resolves the helm issue. The user can also choose to use a different image if they want to.

I'm not really aware of where this deployment script is used, so I am curious if anyone already encountered this issue (I saw there is an issue open for upgrading traefik: #6014).

PR Checklist

  • All necessary documentation has been adapted.
  • The implemented feature is covered by appropriate, automated tests.
  • Any manual testing that has been done is documented (i.e. what exactly was tested?)

🚀 Preview: Add preview label to enable

@claude claude Bot added the deployment Code changes targetting the deployment infrastructure label Mar 18, 2026
@tombch tombch changed the title fix(deployment): add --k3s-image argument to deploy.py fix(deployment): pinned default k3s image and added --k3s-image argument to deploy.py Mar 18, 2026
@tombch tombch changed the title fix(deployment): pinned default k3s image and added --k3s-image argument to deploy.py fix(deployment): default k3s image and --k3s-image argument in deploy.py Mar 18, 2026
@tombch
tombch marked this pull request as ready for review March 18, 2026 13:02
@claude

claude Bot commented Mar 18, 2026

Copy link
Copy Markdown
Contributor

Claude finished @tombch's task in 1m 17s —— View job


Code Review

  • Gather context
  • Review changes
  • Post feedback

Good fix for a real usability issue. The root cause analysis and default version choice are well-reasoned, and the inline comments explaining why v1.31 is used are helpful.

One bug to address: since --k3s-image always has a default value, the if args.k3s_image: guard on line 195 is always True — it's dead code that makes it look like the image might be omitted. It also changes run_command(command, shell=True) to run_command([command], shell=True) without reason (passing a single-element list to shell=True works but is unusual). See inline comment for a suggested simplification.

Minor: the --k3s-image argument is not documented anywhere (README, docs). Given it's a developer-facing change that affects --dev workflows, a note in the relevant docs would be worth adding.

Comment thread deploy.py

@anna-parker anna-parker left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tombch
tombch merged commit c2e3eb0 into main Mar 20, 2026
38 checks passed
@tombch
tombch deleted the k3s-image-arg branch March 20, 2026 11:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

deployment Code changes targetting the deployment infrastructure

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants