I have some services running on a EKS cluster, and I need to have a lambda function to make some operation on these service by calling the service endpoint (by a classic http call).
My Lambda function is running on a the same VPC private subnet than EKS cluster, and the security group should give access to the cluster (port 80 tcp and even 53 udp for dns resolution)
But when I try to make an http request like this: http://my-service.cluster-name.svc.cluster.local/api/list I got a "Name or service not known" error.
For information the hostname work from inside the cluster when I do nslookup or dig command.
Is it possible to access my service from a lambda function? and what go wrong? should I use instead a loadbalancer to access to my service (I don't really like this idea)? I'm missing something?
Many thanks
By default, services in a Kubernetes cluster are accessible only within the cluster's network. The internal DNS names like http://my-service.cluster-name.svc.cluster.local are not directly routable outside the cluster.
To access a Kubernetes service from outside the cluster, you would typically expose the Serviceto the external world by using a Kubernetes Ingress
or LoadBalancer
. This allows external traffic to reach your service.