简体   繁体   English

我是否必须使用 Linkerd 为每个服务定义一个入口?

[英]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查看链接器入口文档here它说我需要创建一个带有注释的入口

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.我希望避免为我在 linkerd 中运行的每个服务创建一个入口。

Yes, unfortunately you understood correctly about creating separate ingress for each service if you want use ingress.kubernetes.io/custom-request-headers .是的,不幸的是,如果您想使用ingress.kubernetes.io/custom-request-headers您对为每个服务创建单独的入口的理解是正确的。 Yes, if you would have 1000 services - you should create 1000 ingresses to make it work properly.是的,如果您有 1000 个服务 - 您应该创建 1000 个入口以使其正常工作。

Ingress1:入口 1:

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:入口2:

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

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. Traefik 是一个很好的解决方案,在这种情况下,如果它可以选择在标头中动态设置服务,那就太好了。

There is an open issue on this in the traefik project that has been open for a while.在已经开放了一段时间的 traefik 项目中有一个关于此的未解决问题 The last update is to use an Ingress per service in these scenarios.最后一次更新是在这些场景中为每个服务使用一个 Ingress。

Here's similar question .这是类似的问题

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM