kubernetestraefik-ingresslinkerd

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.


Solution

  • 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: /