My starting point is standard k3s installation(stable v1.21.5+k3s2), with the default uncluded Traefik setup. I'm trying to use the CRD style. For http everything(IngressRoute, websecure entrypoint, tls setup, host matching, etc.) just works. I think the correct way to setup tcp routing is something like:
apiVersion: traefik.containo.us/v1alpha1 kind: IngressRouteTCP metadata: namespace: somenamespace name: someingressname spec: entryPoints: - someentrypointname routes: - match: HostSNI(`*`) kind: Rule services: - name: targetservname port: targetport
And the problem is that I can't seem to figure out the correct way to setup the new entryPoint. It looks like part of the static traefik configuration. And from the k3s documentation - I'm trying to use HelmChartConfig and avoid directly modifying the traefik deployment and service. Here is what I've tried in /var/lib/rancher/k3s/server/manifests/traefik-config.yaml:
apiVersion: helm.cattle.io/v1 kind: HelmChartConfig metadata: name: traefik namespace: kube-system spec: valuesContent: |- entryPoints: web: address: ":80" http: redirections: entryPoint: to: websecure scheme: https websecure: address: ":443" someentrypointname: address: ":222/tcp" -- apiVersion: helm.cattle.io/v1 kind: HelmChartConfig metadata: name: traefik namespace: kube-system spec: valuesContent: |- additionalArguments: - "--entrypoints.web.address=:80" - "--entrypoints.web.http.redirections.entryPoint.to=websecure" - "--entrypoints.web.http.redirections.entryPoint.scheme=https" - "--entrypoints.websecure.address=:443" - "--entrypoints.someentrypointname.address=:222/tcp" -- apiVersion: helm.cattle.io/v1 kind: HelmChartConfig metadata: name: traefik namespace: kube-system spec: valuesContent: |- additionalArguments: - "--entrypoints.someentrypointname.address=:222/tcp" ports: - containerPort: "222" name: someentrypointname protocol: TCP
The first 2 apply correctly, but the port doesn't seem to be accessible. With the last configuration the helm-install-traefik-xxx pod fails - "Error: template: traefik/templates/service.yaml:9:27: executing "traefik/templates/service.yaml" at <$name>: wrong type for value; expected string; got int."