Kubernetes 入口路径与Azure App Gateway入口控制器不兼容,即使服务的外部IP有效
我已经在AKS上部署了一个服务,Azure应用程序网关入口控制器支持入口。我的问题是入口中定义的路由返回502坏网关,即使路由指向的服务工作正常 如果我从服务中添加Kubernetes 入口路径与Azure App Gateway入口控制器不兼容,即使服务的外部IP有效,kubernetes,azure-aks,azure-application-gateway,Kubernetes,Azure Aks,Azure Application Gateway,我已经在AKS上部署了一个服务,Azure应用程序网关入口控制器支持入口。我的问题是入口中定义的路由返回502坏网关,即使路由指向的服务工作正常 如果我从服务中添加type:LoadBalancer,从而使用它自己的外部IP公开它,那么我可以使用关联应用程序的其余端点调用该IP,而不会出错 kubectl描述svc组织服务的输出-n默认值: Name: organization-service Namespace: default Labels:
type:LoadBalancer
,从而使用它自己的外部IP公开它,那么我可以使用关联应用程序的其余端点调用该IP,而不会出错
kubectl描述svc组织服务的输出-n默认值:
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>
亚马尔:
非常感谢您的帮助。如果可能,请查看入口控制器的日志感谢您抽出时间提供帮助。在重新部署YAML后,我用最近的日志更新了我的OP。添加
kubectl Descripte svc organization service-n default
的输出,并用输出更新。您是否在azure application gateway UI的后端池中看到IP15.0.0.6
?
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"
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: {}