Marcus Ruddick
Marcus Ruddick

Reputation: 10385

Do I have to define an ingress per service with Linkerd?

Looking at the linkerd ingress documentation here it says that I need to create an ingress with an annotation of

ingress.kubernetes.io/custom-request-headers: l5d-dst-override:web-svc.emojivoto.svc.cluster.local:80

this annotation is specific to a single service, which makes it sound like there must be a new ingress with it's own annotation for every service. I couldn't have something like the following for example:

spec:
  rules:
      - host: example.com
        http:
          paths:
            - path: /path-one
              backend:
                serviceName: service-1
                servicePort: 80
            - path: /path-two
              backend:
                serviceName: service-2
                servicePort: 80

where I could define paths to different services in a single ingress class.

Is my reading of these docs accurate? or am I missing something? I am hoping to avoid creating an ingress for every service I run in linkerd.

Upvotes: 2

Views: 848

Answers (2)

cpretzer
cpretzer

Reputation: 236

Traefik is a great solution, and in this case it would be great if it had the option to dynamically set the service in a header.

There is an open issue on this in the traefik project that has been open for a while. The last update is to use an Ingress per service in these scenarios.

Here's similar question.

Upvotes: 0

Vit
Vit

Reputation: 8441

Yes, unfortunately you understood correctly about creating separate ingress for each service if you want use ingress.kubernetes.io/custom-request-headers. Yes, if you would have 1000 services - you should create 1000 ingresses to make it work properly.

Ingress1:

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: web-ingress
  namespace: marcus
  annotations:
    kubernetes.io/ingress.class: "traefik"
    ingress.kubernetes.io/custom-request-headers: l5d-dst-override:service1.marcus.svc.cluster.local:80
spec:
  rules:
  - host: example.com
    http:
      paths:
      - backend:
          serviceName: service1
          servicePort: 80
        path: /

Ingress2:

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: web-ingress
  namespace: marcus
  annotations:
    kubernetes.io/ingress.class: "traefik"
    ingress.kubernetes.io/custom-request-headers: l5d-dst-override:service2.marcus.svc.cluster.local:80
spec:
  rules:
  - host: example.com
    http:
      paths:
      - backend:
          serviceName: service2
          servicePort: 80
        path: /

Upvotes: 2

Related Questions