I have a Kubernetes cluster setup with 2 StatefulSets in a Kube Namespace:
- NFSserver Statefulset defined with a "headless" service that has 1 pod with an attached persistent volume and running an NFS server exporting that Volume.
- DataClient Statefulset has multiple pods mounting the NFS share exported above using NFSv4
The DataClients are responsible for data creation which is then stored on the NFS server volume.
The DataClients do a lot of data read/writes to the NFS volume so I am attempting to optimize the transfers as much as possible. I am currently using a "headless" service (eg the IP address of the POD is provided by KUBEDNS) for the NFSserver which means the NFS packets are directly using the NFSserver POD's IP address.
My issue is that using a headless service the IP address of the NFSserver may change (eg. pod is deleted for a DockerImage update). The clients need to monitor the server IP and update when it changes? All clients then need to 'force' umount the NFS volume (mounted at the old IP address) and immediately remount with the new IP. Using KUBEDNS the new IP address will be provided.
The first question I have is: would there be a performance impact if I use a CLUSTER IP service but allocates a service IP address that will not change when the PODs are deleted/recreated? My thinking has been that having a service IP and a separate pod IP would lead to a 'two hop' situation for every NFS packet. I don't know much about kube-proxy and can't access the kuberenetes nodes to see the IPtables config. I just read the article on kube-proxy using IPtables for routing packets so perhaps there is not the performance hit after all.
Other details:
- Kubernetes cluster runs on 20+ openstack VM nodes
- Persistent Volumes are openstack volumes attached to the openstack VM node where the NFS server POD is running, and then mounted into the POD container
- The NFS clients may be on any of the 20+ VM nodes. It is not possible to have all clients on the same node as the NFS server.
- I do not have node level access, so I cannot see what is going on at the openstack/Linux level of the node. I am confined to container access only.
- In this cluster a kubernetes namespace identifies the lone NFS server and all its clients. There may be multiple namespaces each with an NFS server and multiple clients.
Unfortunately the service providing the Kubernetes infrastructure does not have any support for ReadWriteMany volumes which I suppose (not an expert here) could replace NFS.
NFS does provide what we need if it works correctly. I find it very finnicky with respect to hangs, and unexplained slowness in a client. Advice appreciated.