k3s: K3s v1.27.7+k3s1 and v1.28.3+k3s1 bundle old Traefik CRDs, causing kubernetes api connection issues
Environmental Info: K3s Version:
k3s version v1.27.7+k3s1 (b6f23014)
go version go1.20.10
Describe the bug:
Sorry for omitting some steps of the issue template, but I am reasonable sure that they don’t apply.
We just upgraded from v1.26.6+k3s1 to v1.27.7+k3s1 and now the bundled Traefik instance cannot connect to the kubernetes api anymore, probably since https://github.com/k3s-io/k3s/commit/3abc8b82ed0779ebaa5d0ca00165408ad085cc8f#diff-950b8e60144da8e48c9c65a3e25d0c4cd3264400aca9bbf94d6f30e7dc2f030c
The issue seems to be that Traefik expects a new GKV in their CRDs since Traefik 2.10. The migration from 2.9 to 2.10 is explained here: https://doc.traefik.io/traefik/migration/v2/#kubernetes-crds
K3s bundles the Traefik Helm-Chart at version 21.2.1+up21.2.0 that still includes the old CRDs, which probably is the reason why the bundled RBAC doesn’t apply anymore to Traefik 2.10.
About this issue
- Original URL
- State: closed
- Created 8 months ago
- Reactions: 20
- Comments: 22 (6 by maintainers)
Another way to fix this is to:
traefik.ioapiGroup totraefik-kube-systemCluster Role:traefik.containo.us/v1alpha1totraefik.io/v1alpha1:Also, don’t forget to restart Traefik deployment.
This issue also affects
v1.28.3+k3s1I am able to reproduce the issues on these latest October releases using the following steps:
curl -sfL https://get.k3s.io | INSTALL_K3S_VERSION=v1.27.7+k3s1 sh -The actual result in the current state is:
And the
traefikpod logs are flooded with similar errors:Validated using k3s version v1.28.3-rc1+k3s2 On fresh install and upgrade scenario.
First of all, I confirm, that rolling back image version to
2.9.10works.To make it permanent (if I understood correctly) we can customize HelmChartConfig:
This upgrade bumped Traefik image to
docker.io/rancher/mirrored-library-traefik:2.10.5. It works only with the new CRDs intraefik.ioapiGroup. It ignorestraefik.containo.usresources. The bundled Traefik helm chart includes onlytraefik.containo.usCRDs andtraefik-kube-systemClusterRole is missingtraefik.ioapiGroup. You can see the errors in thetraefikpod(s). Something like:Examples Broken:
Working (after fix I mentioned earlier):
@lifo9 @brandond according to their official readme, they are installing both CRDs in the versions >= v23 https://github.com/traefik/traefik-helm-chart#crds-support-of-traefik-proxy traefik version v21 is installed by k3s by default and should only support the traefik.containo.us api group
Validated using commit id 1ae053d9447229daf8bbd2cd5adf89234e203bcc, ingress routes using the old api group and new api group work as expected using the above test yaml modified to use old and new apigroup
Validated upgrade from v1.27.6+k3s1 (docker.io/rancher/mirrored-library-traefik 2.9.10) to commit 1ae053d9447229daf8bbd2cd5adf89234e203bcc (docker.io/rancher/mirrored-library-traefik 2.10.5 )
Using old apiGroup
Using new apiGroup
I encountered the same issue, it can be temporarily fixed by
kubect edit -n kube-system helmchart traefikand rolling back the image version to2.9.10.