I am in the process of migrating a traditional nginx-fronted reverse proxy to a Kubernetes cluster with Traefik. The end goal is to move everything onto microservices but that might take a while. In the meantime, how do I create an IngressRoute CRD that routes to a legacy system hosted outside the cluster? This would be just a http://server:port kind of forward. I've combed through the docs but it seems Traefik v2.0 has removed support for custom backends and I'm not quite sure how dynamic configuration is supposed to be injected in Kubernetes without an IngressRoute CRD (that does not seem to support server:port definitions)? I might be completely off course here so appreciate any guidance on this.
Found the answer while solving an unrelated problem - turns out Traefik isn't involved in the equation at all - the IngressRoute should remain as-is while the standard Kubernetes service needs to use the type ExternalName
instead of ClusterIP
/NodePort
/LoadBalancer
.
apiVersion: v1
kind: Service
metadata:
name: my-app-name
spec:
externalName: hostname-of-legacy-system
ports:
- port: port-serving-legacy-app
protocol: TCP
targetPort: port-serving-legacy-app
selector:
app: my-app-name
type: ExternalName