Search code examples
kubernetesserviceload-balancingportforwarding

Troubleshooting load balancers service


I have a load balance service that doesn't respond to URI requests. I've tried to debug the services but everything looks ok. Any idea? Btw the pods forward the services but this one can not respond to URI requests. REPO: https://github.com/alfonso84/Kubernete

Service

apiVersion: v1
kind: Service
metadata:
  creationTimestamp: "2021-09-07T18:03:57Z"
  finalizers:
  - service.kubernetes.io/load-balancer-cleanup
  labels:
    app: web
spec:
  clusterIP: 10.103.184.182
  externalTrafficPolicy: Cluster
  ports:
  - name: "80"
    nodePort: 32357
    port: 80
    protocol: TCP
    targetPort: 80
  selector:
    app: web
  sessionAffinity: None
  type: LoadBalancer
status:
  loadBalancer:
    ingress:
    - hostname: a4f3016e4f2244b13babc8ac55dce995-699656471.us-west-2.elb.amazonaws.com

Pod

apiVersion: v1
kind: Pod
metadata:
  creationTimestamp: "2021-09-07T18:03:56Z"
  generateName: web-5f5cb4bdcc-
  labels:
    app: web
    pod-template-hash: 5f5cb4bdcc
spec:
  containers:
  - image: httpd:2.4.39-alpine
    imagePullPolicy: IfNotPresent
    name: httpd
    ports:
    - containerPort: 80
      protocol: TCP

Service describe

Please consider that nodeport and aws hostname is dynamic, in case you notice unmatched.


Solution

  • After a small session, @xnextion and i figured out, why the service was not responding.

    We checked the following points:

    • Does the service selector points to the correct labels of the pod?
    • Did the service generate endpoints resources?
    • Is the pod working correctly? (Was a httpd container exposing port 80, curl localhost from the pod itself, to be sure, configuration is correct)
    • Did the same call from another pod works?

    Finally we figured out, that the pods and services was correct and it was a networkpolicy resource, which denied all traffic.