Search code examples
kuberneteskubectlamazon-elbamazon-eks

Service deployed on EKS does not answer on its EXTERNAL-IP


  1. I created a small application, made a docker image of it, which runs fine locally using docker run.
  2. I created an EKS cluster on amazon.
  3. I put the image up on ECR, wrote a yaml file for a deployment and loadbalancer service, and used kubectl apply -f to deploy to my cluster

I can see my service:

$ kubectl get svc
NAME         TYPE           CLUSTER-IP     EXTERNAL-IP                                                               PORT(S)        AGE
frd-front    LoadBalancer   10.100.199.8   a2c269b1619ee11ea90f20636eb75c46-1160809648.us-east-2.elb.amazonaws.com   80:32594/TCP   40m
kubernetes   ClusterIP      10.100.0.1     <none>                                                                    443/TCP        22h

But if I go to http://a2c269b1619ee11ea90f20636eb75c46-1160809648.us-east-2.elb.amazonaws.com there is no repsponse

  • How can I start troubleshooting this?
  • Do you have any ideas right off the bat?

Thanks =)


Solution

  • The issue can be one of the two reasons:

    1. Docker image: the image may not be exposing the output as expected on the mentioned port.

    2. K8s Service: the service YAML may be configured with wrong target port or service port

    if you find that there is no issue in both the reasons.

    Try to use port-forward on your pod and check weather is available.

    Usage: check for pod

    kubectl port-forward pod-name-765d459796-258hz 8080:8080 // host-port:container-port
    

    check for service

    kubectl port-forward svc/myservice 80:8080
    
    • If both are working fine, then its issue with loadbalancer side or service outbound or network policies.

    • If not working even after port-forward then issue with docker image or deployment yaml.