Azure AKS应用网关Ingress部署出现502错误求助
问题描述
我正在遵循微软Azure官方教程操作,教程中的示例部署正常,但部署本地的配置文件后出现“502 Bad Gateway”错误,该配置在本地环境可正常运行。我希望通过Application Gateway Ingress Controller管理部署并添加Ingress路由规则,目前不知从何入手排查问题。
我的配置文件
apiVersion: apps/v1 kind: Deployment metadata: name: one-api namespace: default annotations: imageregistry: "gcr.io/google-samples/hello-app:1.0" spec: replicas: 3 selector: matchLabels: run: one-api template: metadata: labels: run: one-api spec: containers: - image: gcr.io/google-samples/hello-app:1.0 imagePullPolicy: IfNotPresent name: one-api ports: - containerPort: 80 protocol: TCP --- apiVersion: v1 kind: Service metadata: name: one-api namespace: default spec: ports: - port: 80 protocol: TCP targetPort: 80 selector: run: one-api type: NodePort --- apiVersion: apps/v1 kind: Deployment metadata: name: two-api namespace: default annotations: imageregistry: "gcr.io/google-samples/hello-app:1.0" spec: replicas: 3 selector: matchLabels: run: two-api template: metadata: labels: run: two-api spec: containers: - image: gcr.io/google-samples/hello-app:1.0 imagePullPolicy: IfNotPresent name: two-api ports: - containerPort: 80 protocol: TCP --- apiVersion: v1 kind: Service metadata: name: two-api namespace: default spec: ports: - port: 80 protocol: TCP targetPort: 80 selector: run: two-api type: NodePort --- apiVersion: networking.k8s.io/v1 kind: Ingress metadata: name: strata-2022 labels: app: my-docker-apps annotations: kubernetes.io/ingress.class: azure/application-gateway spec: rules: - http: paths: - path: / pathType: Prefix backend: service: name: one-api port: number: 80 - path: /two-api pathType: Prefix backend: service: name: two-api port: number: 80
命令执行输出
kubectl describe ingress strata-2022 输出
Name: strata-2022 Labels: app=my-docker-apps Namespace: default Address: 51.142.191.83 Ingress Class: Default backend: Rules: Host Path Backends ---- ---- -------- * / one-api:80 (10.224.0.15:80,10.224.0.59:80,10.224.0.94:80) /two-api two-api:80 (10.224.0.13:80,10.224.0.51:80,10.224.0.82:80) Annotations: kubernetes.io/ingress.class: azure/application-gateway Events:
kubectl describe ingress 输出
Name: strata-2022 Labels: app=my-docker-apps Namespace: default Address: 51.142.191.83 Ingress Class: <none> Default backend: <default> Rules: Host Path Backends ---- ---- -------- * / one-api:80 (10.224.0.15:80,10.224.0.59:80,10.224.0.94:80) /two-api two-api:80 (10.224.0.13:80,10.224.0.51:80,10.224.0.82:80) Annotations: kubernetes.io/ingress.class: azure/application-gateway Events: <none>
创建AKS集群及部署相关命令
# 创建AKS集群 az aks create -n myCluster -g david-tutorial --network-plugin azure --enable-managed-identity -a ingress-appgw --appgw-name testApplicationGateway --appgw-subnet-cidr "10.225.0.0/16" --generate-ssh-keys # 获取凭证并切换上下文 az aks get-credentials -n myCluster -g david-tutorial # 教程中的示例命令(可正常运行) # kubectl apply -f https://raw.githubusercontent.com/Azure/application-gateway-kubernetes-ingress/master/docs/examples/aspnetapp.yaml # 执行的部署命令(本地配置可正常运行,注:原命令中`nano`为文件编辑命令,实际部署应为直接指定文件) kubectl apply -f new-deploy.yaml # 获取地址 kubectl get ingress # 获取configmap kubectl get configmap
内容的提问来源于stack exchange,提问作者user3067684
相关产品推荐
相关产品推荐

