Disabling Bundled Components
Turn off Traefik, ServiceLB, or other add-ons when you want to bring your own.
k3s bundles handy defaults, but sometimes you want to replace them. The --disable flag (or the disable list in the config file) tells k3s not to install a packaged component.
Commonly disabled add-ons
traefik— to install NGINX Ingress or another controller.servicelb— to use MetalLB instead.local-storage— to use Longhorn or another provisioner.metrics-server— if you run your own monitoring stack.
Example
# Disable Traefik and ServiceLB at install time
curl -sfL https://get.k3s.io | \
sh -s - --disable=traefik --disable=servicelb
# Or list them in /etc/rancher/k3s/config.yaml:
# disable:
# - traefik
# - servicelbWhen to use it
- A team disables Traefik and installs the NGINX ingress controller instead because their existing ingress rules are written for NGINX annotations.
- An operator disables ServiceLB so MetalLB can handle LoadBalancer IP assignment with BGP advertisement on a bare-metal network.
- A cluster administrator disables the metrics-server bundled with k3s and installs a custom version with specific resource requests.
More examples
Disable Traefik at install time
Installs k3s while disabling both Traefik and ServiceLB so custom ingress and load-balancer solutions can be installed.
curl -sfL https://get.k3s.io | \
INSTALL_K3S_EXEC='--disable traefik --disable servicelb' sh -
kubectl get pods -n kube-systemDisable components via config file
Lists all add-ons to disable in the YAML config file, which k3s reads at startup without requiring command-line flags.
# /etc/rancher/k3s/config.yaml
disable:
- traefik
- servicelb
- local-storage
- metrics-serverVerify component is removed
Confirms that Traefik pods and IngressClass no longer exist after disabling the bundled component.
kubectl get pods -n kube-system
kubectl get ingressclass
# traefik pod and IngressClass should be absent
Discussion