Resolve pods and services from host

Hi, is there any way to make the pod names or services resolve from the host? From inside the pod they resolve correctly, but it would be useful to be able to be able to access them by name from the outside.

if you are on a single node, you can take the service clusterip, add it to your /etc/hosts you shud be able to access it by the name defined in the hosts file.
But definitely not recommended to do like that. Using ingress will be far better and ia the intended use.

I’m doing that, but if I redeploy I need to edit the host files every time. At least for development purposes it would be easier if I can refer to the pods by name.

The ClusterIP shouldn’t change when you redeploy your pod, unless you delete the Service manifests and reapply.

These are normal behaviors, if you want to access your pods from outside the cluster, i recommend the use of ingress or NodePort service. A NodePort will expose a port to the host so that you can access the pods using nodeip:nodeport

I normally use ingress and use the magic dns like Check this out.