NodePort not working with AWS EKS server endpoint
You should be using your Worker Node's IP (one of the nodes if you have more than one), not the EKS server endpoint. The EKS server endpoint is the master plane, meant to process requests pertaining to creating/deleting pods, etc.
You also need to make sure that the Security Group of your Node's will allow the traffic.
With this in place you should be able to make the request to your NodePort service.For Example:
For temp solution
you need run kubectl port-forward
to redirect it to your local and access with https://localhost:30002
Remember:
kubectl port-forward
command binds the address127.0.0.1
only, which means you can't visit the forward port from outside the server. So you have to run it locally
$ kubectl port-forward $(kubectl get pod -l "app=fakeserver" -o jsonpath={.items[0].metadata.name}) 30002
Access via loadbalancer
If you need access it permanently, you need change service type to LoadBalancer
, then access this service via its loadbalancer url or you can you define another route53 DNS to redirect to this loadbalancer.
The service that you have created is of type - Node-Port. Did you try with :30002
If it also returns the same error, then its an issue that your deployment.Check the port exposed on the container and the target port. It should be same.