Hello,
I´m trying to use the kubernetes crd provider to configure TCP services, but it seems that I cannot use any other Kubernetes service kind than externalName to get this running.
The documentation is not very specific about that:
https://docs.traefik.io/master/routing/providers/kubernetes-crd/#kind-ingressroutetcp
I want to use the ClusterIP service for cluster-internal communication and don´t want to create another Service just for tcp traffic. Do you kindly have any advice for me?
Doesn´t work:
apiVersion: traefik.containo.us/v1alpha1
kind: IngressRouteTCP
metadata:
name: central-whoami-frontend-sftp
namespace: whoami-dev
spec:
entryPoints:
- whoamisftp
routes:
- match: HostSNI(`*`)
services:
- name: whoami-frontend-20200512113419
port: 7722
weight: 10
terminationDelay: 400
---
apiVersion: v1
kind: Service
metadata:
labels:
app.kubernetes.io/instance: whoami-frontend-20200512113419
app.kubernetes.io/name: whoami-frontend
name: whoami-frontend-20200512113419
namespace: whoami-dev
spec:
type: ClusterIP
ports:
- name: sftp
port: 7722
protocol: TCP
targetPort: 7722
- name: rest
port: 7080
protocol: TCP
targetPort: 7080
selector:
app.kubernetes.io/instance: whoami-frontend-20200512113419
app.kubernetes.io/name: whoami-frontend
Does work (IngressRouteTCP is pointing to externalName service):
apiVersion: traefik.containo.us/v1alpha1
kind: IngressRouteTCP
metadata:
name: central-whoami-frontend-sftp
namespace: whoami-dev
spec:
entryPoints:
- whoamisftp
routes:
- match: HostSNI(`*`)
services:
- name: whoami-frontend-20200512113419-traefik
port: 7722
weight: 10
terminationDelay: 400
---
apiVersion: v1
kind: Service
metadata:
labels:
app.kubernetes.io/instance: whoami-frontend-20200512113419
app.kubernetes.io/name: whoami-frontend
name: whoami-frontend-20200512113419
namespace: whoami-dev
spec:
type: ClusterIP
ports:
- name: sftp
port: 7722
protocol: TCP
targetPort: 7722
- name: rest
port: 7080
protocol: TCP
targetPort: 7080
selector:
app.kubernetes.io/instance: whoami-frontend-20200512113419
app.kubernetes.io/name: whoami-frontend
---
apiVersion: v1
kind: Service
metadata:
name: whoami-frontend-20200512113419-traefik
namespace: whoami-dev
spec:
externalName: whoami-frontend-20200512113419.whoami-dev
type: ExternalName
ports:
- port: 7722