K3s: Unable to disable Traefik

Created on 3 Dec 2019  路  6Comments  路  Source: k3s-io/k3s

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.

kinquestion

Most helpful comment

For the record and future me, this is what needs to be done to disable Traefik during initial setup:

  1. Remove traefik helm chart resource: kubectl -n kube-system delete helmcharts.helm.cattle.io traefik
  2. Stop the k3s service: sudo service k3s stop
  3. Edit service file sudo nano /etc/systemd/system/k3s.service and add this line to ExecStart:
    --no-deploy traefik \
  1. Reload the service file: sudo systemctl daemon-reload
  2. Remove the manifest file from auto-deploy folder: sudo rm /var/lib/rancher/k3s/server/manifests/traefik.yaml
  3. Start the k3s service: sudo service k3s start

All 6 comments

I think you'll have to manually remove the resources defined by traefik.yaml. Removing the manifest and restarting won't remove any resources that already exist.

I guess then the official documentation is somewhat misleading. It says in docs:

To disable it [Traefik], start each server with the --no-deploy traefik option.

Obviously when installing k3s with the install script this is not enough. I also have to remove the previously created resources. I haven't checked it, but is there a configuration switch in the install.sh script that prevents deploying resources to the cluster during initial setup?

For the record and future me, this is what needs to be done to disable Traefik during initial setup:

  1. Remove traefik helm chart resource: kubectl -n kube-system delete helmcharts.helm.cattle.io traefik
  2. Stop the k3s service: sudo service k3s stop
  3. Edit service file sudo nano /etc/systemd/system/k3s.service and add this line to ExecStart:
    --no-deploy traefik \
  1. Reload the service file: sudo systemctl daemon-reload
  2. Remove the manifest file from auto-deploy folder: sudo rm /var/lib/rancher/k3s/server/manifests/traefik.yaml
  3. Start the k3s service: sudo service k3s start

@riker09 you can still use the no-deploy with the install script, you just need to run the command as follows:

curl -sfL https://get.k3s.io | INSTALL_K3S_EXEC="server --no-deploy traefik" sh

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

Use the --no-deploy traefik flag and value when installing. Please let us know if there are any other questions / concerns.

Just updating to mention that --no-deploy is deprecated, and now people referring to this should use --disable instead.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

gilkotton picture gilkotton  路  3Comments

pierreozoux picture pierreozoux  路  4Comments

e-nikolov picture e-nikolov  路  3Comments

seanmalloy picture seanmalloy  路  3Comments

joakimr-axis picture joakimr-axis  路  3Comments