Ping container running on specific host

I have service with NFS server with scheduling configured to deploy on all hosts with persistent storage, so its storage can be used by services across environment (with epheral instances also - not persistent storage).

How this NFS server can be accessible from clients? I can not use just service alias, because it will target to all servers randomly. I need some DNS name to specific service on specific host.

Is it possible without exposing NFS ports to external network (I want to keep it inside overlay network)?

Just to clarify:

ping nfs-server will alternately return different IPs, each on different host

I want something what will return IP to specific host:
ping nfs-server.host1 will always return IP to nfs-server running on host1
ping nfs-server.host2 will always return IP to nfs-server running on host2

And without port mapping to host network, because it will expose nfs-server to the Internet or (if I block it on firewall) nfs-server will not be accessible by services on the different hosts.

NFS servers will be then used only by Rancher NFS volume drivers.

1 Like

+1 I’d love to be able to resolve DNS name to the service container on the same host, not a random one. Something like prefer-local/only-local labels that loadbalancers have. This way I could just scale some internal service like Memcached and be sure that other containers would use local instance.

I’ve created GitHub issue for this feature: