Michael C
Michael C

Reputation: 39

Traefik kubernetes crd - proxy external host

Can traefik act as a reverse proxy for some external endpoint ? Like nginx's proxy path for a specific location. For example, I'd like to perform transparent reverse-proxying to https://app01.host.com which is in another datacenter

apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
metadata:
  name: backend01-ingressroute-app
spec:
  entryPoints:
    - websecure
  routes:
  - match: Host(`backend01.host.local`) && PathPrefix(`/app`)
    kind: Rule
    services:
....

backend01.host.local/app -> https://app01.host.com ? But what I need to specify as "services" here to achieve that ?

Upvotes: 1

Views: 2262

Answers (2)

firstdorsal
firstdorsal

Reputation: 53

I found that external name services are per default disabled when using traefik with helm. Note that this has to be set for kubernetesCRD and for kubernetesIngress seperately. This is not explained well in the documentation: https://doc.traefik.io/traefik/routing/providers/kubernetes-crd/#kind-ingressroute

traefik helm values file:

...
#
# Configure providers
#
providers:
  kubernetesCRD:
    enabled: true
    allowCrossNamespace: false
    allowExternalNameServices: false # <- This needs to be true
    # ingressClass: traefik-internal
    # labelSelector: environment=production,method=traefik
    namespaces:
      []
      # - "default"

  kubernetesIngress:
    enabled: true
    allowExternalNameServices: false # <- This needs to be true
    # labelSelector: environment=production,method=traefik
    namespaces:
...

Upvotes: 2

tuxiedev
tuxiedev

Reputation: 179

Yes. The traefik documentation on ExternalName services pretty much covers the use case you're looking for

https://docs.traefik.io/routing/providers/kubernetes-crd/

Couldn't get a direct link, so please do a "find in page" for ExternalName

Upvotes: 1

Related Questions