Reputation: 137
i'm working on a new idea for which I've created a setup as follows on 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.
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.
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. what i specified for the AKS App gateway. 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)
After configuring, now when i try to access the App gateway IP as is, i get a 502 Bad Gateway error. I'm very new to AKS
Upvotes: 2
Views: 7557
Reputation: 647
I don't see below annotations in your 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.
Upvotes: 2