We are have enabled horizontal pod autoscaling in GKE, our pods are sitting behind a clusterIP type service and we are routing public traffic to that Service using NGINX Ingress controller. When monitoring the usages we have noticed that traffic is not equally distributed between pods. it's routing traffic to one single pod. but whenever we manually deleted that particular pod it will route traffic to another available pod.
Is there any way we can enable ingress rules to distribute traffic equally
Ingress
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
annotations:
kubernetes.io/ingress.class: nginx
kubernetes.io/tls-acme: "true"
nginx.ingress.kubernetes.io/load-balance: round_robin
nginx.ingress.kubernetes.io/ssl-passthrough: "true"
nginx.ingress.kubernetes.io/ssl-redirect: "false"
nginx.org/proxy-connect-timeout: 30s
nginx.org/proxy-read-timeout: 20s
generation: 11
name: test-ingress
namespace: default
spec:
rules:
- host: gateway.example.com
http:
paths:
- backend:
serviceName: gateway-443
servicePort: 443
path: /
- backend:
serviceName: gateway-80
servicePort: 80
path: /
Service manifest
apiVersion: v1
kind: Service
metadata:
annotations:
cloud.google.com/neg: '{"ingress":true}'
serviceloadbalancer/lb.cookie-sticky-session: "false"
serviceloadbalancer/lb.host: gateway.example.com
serviceloadbalancer/lb.sslTerm: "true"
labels:
name: gateway-default
port: gateway-default-8243
name: gateway-8243
namespace: default
spec:
clusterIP: 10.20.215.122
ports:
- name: pass-through-https
port: 443
protocol: TCP
targetPort: 8243
selector:
name: gatway-default
sessionAffinity: ClientIP
type: ClusterIP