Skip to content

fix(containerd): update k3s systemd unit restart to support agent mode#621

Open
vdice wants to merge 1 commit intospinframework:mainfrom
vdice:fix/k3s-restart-systemd
Open

fix(containerd): update k3s systemd unit restart to support agent mode#621
vdice wants to merge 1 commit intospinframework:mainfrom
vdice:fix/k3s-restart-systemd

Conversation

@vdice
Copy link
Collaborator

@vdice vdice commented Mar 12, 2026

Describe your changes

Updates the k3s restart logic when systemd units are used to check if either k3s or k3s-agent is the registered service.

#620 has more detail, but essentially most real-world k3s clusters use the latter k3s-agent service while quickstart/minimal k3s deployments (eg curl -sfL https://get.k3s.io | sh - use k3s)

Note the TODO around allowing specification of the registered service, as it appears the k3s installer script allows customization. This should be a separate follow-up if deemed necessary.

Issue ticket number and link

#620

Checklist before requesting a review

  • I have performed a self-review of my code
  • If it is a core feature, I have added thorough tests.
  • I tested the changes with the following distributions:
    • Kind
    • MiniKube
    • MicroK8s
    • Rancher RKE2
    • Azure AKS
    • GCP GKE (Ubuntu nodes)
    • AWS EKS (AmazonLinux2 nodes)
    • AWS EKS (Ubuntu nodes)
    • Digital Ocean Kubernetes

Signed-off-by: Vaughn Dice <vdice@akamai.com>
@vdice vdice force-pushed the fix/k3s-restart-systemd branch from 8463afd to 0a84e60 Compare March 13, 2026 18:37
out, err := nsenterCmd("systemctl", "restart", "k3s").CombinedOutput()
// First, collect systemd units to determine which k3s service to restart
// TODO: It appears the service name itself can be customized, so we may want to consider similar support
// See https://github.com/k3s-io/k3s/blob/main/install.sh
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you create a follow up issue for this?

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

Labels

kind/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants