# IngressRouteTCP in Kubernetes for headless service

**URL:** <https://community.traefik.io/t/ingressroutetcp-in-kubernetes-for-headless-service/13726>\
**Category:** Traefik v2\
**Tags:** kubernetes-ingress\
**Created:** [March 10, 2022, 3:38pm UTC](https://community.traefik.io/t/ingressroutetcp-in-kubernetes-for-headless-service/13726 "2022-03-10T15:38:45Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![lk777](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/lk777/32/5061_2.png) [@lk777](https://community.traefik.io/u/lk777)\
**Post date:** [March 12, 2022, 5:06pm UTC](https://community.traefik.io/t/ingressroutetcp-in-kubernetes-for-headless-service/13726/6 "2022-03-12T17:06:26Z")

</div>

I think I figured it out.  
In my case traefik is a part of k3s.  
To add a static configuration for this custom Traefik installation (so this is specifically for my "cattle" fellows only):

1. Created /var/lib/rancher/k3s/server/manifests/traefik-override.yaml with the following content:

```auto
piVersion: helm.cattle.io/v1
kind: HelmChartConfig
metadata:
  name: traefik
  namespace: kube-system
spec:
  valuesContent: |-
    additionalArguments:
    - "--providers.file.filename=/config/traefik-config.toml"
    - "--entrypoints.mongodb=true"
    ports:
      mongodb:
        port: 27017
        protocol: TCP

```

1. Restarted k3s.service  
`- "--providers.file.filename=/config/traefik-config.toml"` - is for the future dynamic configuration and I haven't test it yet

[Rancher Docs: Helm](https://rancher.com/docs/k3s/latest/en/helm/#customizing-packaged-components-with-helmchartconfig)

```auto
apiVersion: traefik.containo.us/v1alpha1
kind: IngressRouteTCP
metadata:
  name: mongo-route
  namespace: mongodb

spec:
  entryPoints:
   - mongodb

  routes:
  - match: HostSNI('*')
    services:
    - name: mongodb-cluster-svc
      port: 27017

```

Now I see in the traefik dashboard my 'mongodb' entrypoint and a successfully created TCP router and Service with discovered pods behind it.

Unfortunately, my mongo string still doesn't work but this is just another painful MongoDB experience.

---

_[View the full topic](https://community.traefik.io/t/ingressroutetcp-in-kubernetes-for-headless-service/13726)._
