[英]AKS BAD Gateway 502 Error when accessing Gateway IP
i'm working on a new idea for which I've created a setup as follows on Azure Kubernetes:我正在研究一个新想法,为此我在 Azure Kubernetes 上创建了如下设置:
I'm trying to submit a json request into the loadbalancer from outside the cluster with an AKS IP, to which i encounter 502 Bad Gateway issues.我正在尝试使用 AKS IP 从集群外部向负载均衡器提交 json 请求,我遇到了 502 Bad Gateway 问题。
This is my deployment file这是我的部署文件
apiVersion: apps/v1
kind: Deployment
metadata:
name: deployment-1
spec:
selector:
matchLabels:
app: deployment-1
replicas: 2
template:
metadata:
labels:
app: deployment-1
spec:
containers:
- name: api-1
image: dummy
imagePullPolicy: Always
ports:
- containerPort: 5000
nodeSelector:
agentpool: analytics1
---
apiVersion: v1
kind: Service
metadata:
name: service-1
annotations:
service.beta.kubernetes.io/azure-dns-label-name: dummy
service.beta.kubernetes.io/azure-load-balancer-internal: "true"
spec:
type: LoadBalancer
ports:
- port: 5000
selector:
app: deployment-1
Checking if services are running.检查服务是否正在运行。
LAMU02Y36ZHJG5J% kubectl get svc
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
cloud-api-v4-svc LoadBalancer 10.0.63.65 10.240.0.5 80:30054/TCP 37d
kubernetes ClusterIP 10.0.0.1 <none> 443/TCP 47d
service-1 LoadBalancer 10.0.55.129 10.240.0.9 5000:30507/TCP 41h
i use this LoadBalancer IP (10.240.0.9) to create an ingress service as below.我使用这个 LoadBalancer IP (10.240.0.9) 创建如下入口服务。
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: ingress-1
annotations:
kubernetes.io/ingress.class: addon-http-application-routing
spec:
rules:
- host: service-1.a3333fc09cb44a6b86b8.eastus.aksapp.io
- http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: service-1
port:
number: 5000
And this is after ingress is created.这是在创建入口之后。
LAMU02Y36ZHJG5J% kubectl get ingress
NAME CLASS HOSTS ADDRESS PORTS AGE
ingress-1 <none> service-1.a333fc09cb44a6b86b8.eastus.aksapp.io 20.84.1.20 80 65m
So i think things are good, and then i go ahead to create my AKS application gateway so it's accessible from any IP.所以我认为事情很好,然后我提前 go 创建我的 AKS 应用程序网关,以便可以从任何 IP 访问它。 what i specified for the AKS App gateway.
我为 AKS App 网关指定的内容。 backend pool IP - 20.84.1.20 with port 80 ( which is the Ingress IP. i'm not sure if this is where i'm going wrong)
后端池 IP - 20.84.1.20,端口为 80(这是入口 IP。我不确定这是否是我出错的地方)
After configuring, now when i try to access the App gateway IP as is, i get a 502 Bad Gateway error.配置后,现在当我尝试按原样访问应用程序网关 IP 时,出现 502 Bad Gateway 错误。 I'm very new to AKS
我对 AKS 很陌生
I don't see below annotations in your Ingress..我在您的 Ingress 中没有看到以下注释。
Can you add them and try?您可以添加它们并尝试吗?
appgw.ingress.kubernetes.io/use-private-ip: "false"
kubernetes.io/ingress.class: azure/application-gateway
This is where you can see more details in Troubleshoot common questions or issues with Ingress Controller .您可以在此处查看有关 Ingress Controller 的常见问题或问题的疑难解答中的更多详细信息。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.