k3s: Unable to disable Traefik
Version: k3s version v1.0.0 (18bd921c)
Describe the bug I am unable to disable the build-in traefik load balancer.
To Reproduce
According to documentation all files in /var/lib/rancher/k3s/server/manifests are automatically deployed. I have removed the traefik.yaml file from this folder and changed /etc/systemd/system/k3s.service, followed by systemctl daemon-reload (everything as root user, of course).
The new service file has these lines in it:
ExecStart=/usr/local/bin/k3s \
server \
--docker \
--no-deploy traefik \
Restart k3s service with service k3s stop && service k3s start. (yes, I also tried service k3s restart)
Expected behavior
Expected kubectl -n kube-system get pods to not list traefik pod.
Actual behavior
The pod is still restarted on each service restart.
Additional context
Ubuntu 19.10 with Docker 19.03.2.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 4
- Comments: 26 (7 by maintainers)
For the record and future me, this is what needs to be done to disable Traefik during initial setup:
kubectl -n kube-system delete helmcharts.helm.cattle.io traefiksudo service k3s stopsudo nano /etc/systemd/system/k3s.serviceand add this line toExecStart:sudo systemctl daemon-reloadsudo rm /var/lib/rancher/k3s/server/manifests/traefik.yamlsudo service k3s startJust updating to mention that
--no-deployis deprecated, and now people referring to this should use--disableinstead.@riker09 you can still use the no-deploy with the install script, you just need to run the command as follows:
This will configure the server with no traefik and you wont find it in the manifests
thats also described here in the docs https://rancher.com/docs/k3s/latest/en/installation/install-options/#installation-script-options
Disable traefik post installation:
This should be a better approach, except for cleaning up the traefik part, which is in fact the main reason I’m here. We no longer need to use parameters or environment variables to modify systemd service files. And have good compatibility with upgrades, I think. If you want to re-enable traefik, just delete traefik.yaml.skip and restart k3s. About the
.skipfiles: https://rancher.com/docs/k3s/latest/en/installation/disable-flags/@cawoodm Maybe you missed the = between disable and traefik
This still seems to be an issue. Following the instructions @Cesarsk and @himao posted seems to clean up everything but the traefik service. I run kubectl delete svc traefik -n kube-system and it says it is deleted but the command never returns back to the prompt. It also is still in the get request.
no, now you’ve got a pipe with no command. You want both of the variables after the pipe
curl -sfL https://get.k3s.io | K3S_KUBECONFIG_MODE="644" INSTALL_K3S_EXEC="server --disable=traefik" sh -