NodePort not working with AWS EKS server endpoint
Asked Answered
L

3

9

eks server endpoint is xxxxxxxxxxx.xxx.eks.amazonaws.com and I've created a yml file with a deployment and service object.

[ec2-user@ip-]$ kubectl get svc
NAME         TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)          AGE
fakeserver   NodePort    10.100.235.246   <none>        6311:30002/TCP   1h
kubernetes   ClusterIP   10.100.0.1       <none>        443/TCP          1d

When I browse xxxxxxxxxxx.xxx.eks.amazonaws.com:30002 returns too long to respond. security groups have all traffic in inbound rules.

Lathe answered 25/7, 2018 at 19:49 Comment(1)
There's not enough info here. Please post your deployment manifest, service manifest and any logs you can get from fakeserverSecant
M
3

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:

http://your-workernodeIp:NodePortNumber

Merchantman answered 21/1, 2020 at 22:52 Comment(2)
what happens if I have autoscaling? I can't know which new IP will be assigned.Dagenham
How to get the worker node's IP?Holly
B
1

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 address 127.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.

Blighter answered 26/7, 2018 at 0:54 Comment(0)
I
0

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.

Iconoduly answered 11/8, 2019 at 15:38 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.