AWS ALB 重定向 url EKS

问题描述 投票:0回答:1

我有一个子域 app.service.com

我在 EKS 中托管一个应用程序,在我的入口控制器中有两个不同的路径(应用程序 1、应用程序 2)。两条路径目前都在运行相同的应用程序

是否可以将 url http://app.service.com/app1/regionshttp://app.service.com/app2/regions 重写为 http://app.service.com /地区

简而言之,应该为我将调用的任何端点删除路径标记 app1/app2。当我使用 ngnix ingress 时,这对我来说在 azure kubernetes 中具有重写规则是可能的 对于以 ALB 作为入口的 AWS kubernetes 是否有任何替代方法

amazon-web-services kubernetes-ingress amazon-eks aws-application-load-balancer
1个回答
0
投票

AWS LB 控制器支持允许您配置此类重定向的注释:查找项目

alb.ingress.kubernetes.io/actions.${action-name}
.

下面是示例 ingress yaml

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  namespace: default
  name: ingress
  annotations:
       alb.ingress.kubernetes.io/actions.redirect-to-eks: '[{"type": "redirect", "redirectConfig": {"host":"www.example.com","path":"/eks/"}}]'
spec:
  rules:
    - host: www.example.com
      http:
        paths:
          - path: /path1
            backend:
              serviceName: rule-path1
              servicePort: use-annotation
          - path: /path2
            backend:
              serviceName: rule-path2
              servicePort: use-annotation

您可以在此文档中找到有关它的更多信息。

© www.soinside.com 2019 - 2024. All rights reserved.