Azure Kubernetes Services 502 Bad Gateway

10/5/2018

I have AKS cluster up and running and on a heavy user load I get some 502 bad gateway responses. This only happens when the request load is high. I used the Azure DevOps load testing to achieve this behavior. I believe that it has something to do with the Load Balancer timeouts but I am not too sure how to go about debugging this. Perhaps I should be checking logs somehwere? Searching around google tells me that i should be checking nginx logs but not sure where to find those. Sorry I am newbie in kubernettes world.

These are all the pods that are in the cluster. apsever-api-... are my actual apps that serve the request: enter image description here

The YAML file used to generate this:

# DS for AP
kind: DaemonSet
apiVersion: extensions/v1beta1
metadata:
  name: apserver-api
spec:
  updateStrategy:
    type: RollingUpdate 
  selector:
  template:
    metadata:
      labels:
        app: apserver-api
    spec:
      containers:
      - name: apserver-api
        image: IMAGE
        env:
        - name: APP_SVC
          value: apserver-api
        ports:
        - containerPort: 80
        imagePullPolicy: IfNotPresent
# Service for AP
kind: Service
apiVersion: v1
metadata:
  labels:
    app: apserver-api
  name: apserver-api
spec:
  type: ClusterIP
  ports:
  - name: http
    port: 80
  - name: https
    port: 443
    targetPort: 80
  selector:
    app: apserver-api
  type: "LoadBalancer"

and screenshot of the load test:enter image description hereenter image description here

-- scorpion5211
azure
kubernetes
nginx

0 Answers