如何解决入口路径不能与Azure App Gateway入口控制器一起使用,即使服务的外部IP可以工作
我已经在AKS上部署了服务,并且Azure应用程序网关Ingress Controller支持了入口。我的问题是,即使该路由指向的服务运行正常,入口中定义的路由也会返回502 Bad Gateway。
如果我从服务中添加type: LoadBalancer
,从而使用其自己的外部IP对其进行公开,那么我可以使用相关应用程序的REST端点调用该IP,而不会出错。
kubectl describe svc organization-service -n default
的输出:
Name: organization-service
Namespace: default
Labels: <none>
Annotations: Selector: app=organization-service
Type: ClusterIP
IP: 10.0.96.206
Port: <unset> 80/TCP
TargetPort: 5001/TCP
Endpoints: 15.0.0.6:5001
Session Affinity: None
Events: <none>
AGW入口控制器日志:
I0917 16:28:24.300899 1 mutate_app_gateway.go:177] BEGIN AppGateway deployment
I0917 16:28:54.715631 1 mutate_app_gateway.go:185] Applied generated Application Gateway configuration
I0917 16:28:54.715668 1 mutate_app_gateway.go:200] cache: Updated with latest applied config.
I0917 16:28:54.716136 1 mutate_app_gateway.go:204] END AppGateway deployment
I0917 16:28:54.716149 1 controller.go:151] Completed last event loop run in: 30.516738446s
I0917 16:28:55.768237 1 mutate_app_gateway.go:164] cache: Config has NOT changed! No need to connect to ARM.
I0917 16:28:55.768260 1 controller.go:151] Completed last event loop run in: 51.85209ms
E0917 16:29:30.646794 1 ingress_rules.go:159] Ingress default/organization-service references non existent Service default/organization-service. Please correct the Service section of your Kubernetes YAML
E0917 16:29:30.647006 1 backendhttpsettings.go:89] Unable to get the service [default/organization-service]
E0917 16:29:30.647113 1 context.go:248] Code="ErrorFetchingEnpdoints" Message="Endpoint not found for default/organization-service"
E0917 16:29:30.647126 1 backendaddresspools.go:103] Code="ErrorFetchingEnpdoints" Message="Endpoint not found for default/organization-service"
E0917 16:29:30.647207 1 context.go:248] Code="ErrorFetchingEnpdoints" Message="Endpoint not found for default/organization-service"
E0917 16:29:30.647215 1 backendaddresspools.go:103] Code="ErrorFetchingEnpdoints" Message="Endpoint not found for default/organization-service"
E0917 16:29:30.647230 1 context.go:248] Code="ErrorFetchingEnpdoints" Message="Endpoint not found for default/organization-service"
E0917 16:29:30.647235 1 backendaddresspools.go:103] Code="ErrorFetchingEnpdoints" Message="Endpoint not found for default/organization-service"
YAML:
apiVersion: extensions/v1beta1
kind: Ingress
Metadata:
name: organization-service
annotations:
kubernetes.io/ingress.class: azure/application-gateway
spec:
rules:
- http:
paths:
- path: /
backend:
serviceName: organization-service
servicePort: 80
---
apiVersion: v1
kind: Service
Metadata:
name: organization-service
spec:
selector:
app: organization-service
ports:
- protocol: TCP
port: 80
targetPort: 5001
---
apiVersion: v1
kind: Pod
Metadata:
name: organization-service
labels:
app: organization-service
spec:
containers:
- image: acrprodnortheurope.azurecr.io/organization-service:deploy
name: organization-service
ports:
- containerPort: 5001
protocol: TCP
env:
- name: sql_SERVER_CONN_STR
valueFrom:
secretKeyRef:
name: organization-service
key: conn_str
resources: {}
非常感谢您的帮助。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。