-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Description
Environmental Info:
K3s Version: n/a
Node(s) CPU architecture, OS, and Version:
n/a
Cluster Configuration:
n/a
Describe the bug:
When running K3s in docker, or with --log=/path/to/log, the process is terminated immediately, instead of waiting for the context cancellation to complete.
Steps To Reproduce:
- Run K3s docker image:
docker run -it --rm --privileged docker.io/rancher/k3s:v1.33.4-k3s1 server - Stop the container by pressing control-C
Expected behavior:
K3s receives SIGINT and shuts down cleanly, same as the logs show when you systemctl stop k3s to stop a running server:
Sep 15 19:29:25 systemd-node-001 systemd[1]: Stopping Lightweight Kubernetes...
Sep 15 19:29:25 systemd-node-001 k3s[260]: time="2025-09-15T19:29:25Z" level=warning msg="signal received: \"terminated\", canceling context..."
Sep 15 19:29:25 systemd-node-001 k3s[260]: I0915 19:29:25.792697 260 vxlan_network.go:79] evts chan closed
Sep 15 19:29:25 systemd-node-001 k3s[260]: I0915 19:29:25.792764 260 network_policy_controller.go:204] Shutting down network policies controller
Sep 15 19:29:25 systemd-node-001 systemd[1]: k3s.service: Deactivated successfully.
Actual behavior:
The container receives SIGINT (from the control-c) at the same time as the SIGTERM from its parent process exiting, as the parent process does not wait for the child to exit before terminating.
WARN[0098] signal received: "interrupt", canceling context...
WARN[0098] second signal received: "terminated", exiting...
Note the second signal received message, which is not present when running K3s as a service, or via the command line without --log.
Additional context / logs:
Metadata
Metadata
Assignees
Labels
Type
Projects
Status