kubernetes NFS clients need to use Elastifile DNS Round-Robin for load-balancing.
GCP hosted Elastifile Fileserver configured with DNS name of "sandpit-09.local"
DNS Name |
sandpit-09.local |
VIP |
10.128.0.5 |
vHead |
10.128.0.6 |
10.128.0.7 |
10.128.0.8 |
name server IP defined for the K8 configmap is Elastifile NFS VIP (10.128.0.5)
subDomain defined for the K8 configmap is Elastifile NFS service name (sandpit-09.local)
Create file "elfsDomains" to supply as kubernetes configmap
cloudshell:~/k8 (elastifile-sa)$ cat elfsDomains
apiVersion: v1
kind: ConfigMap
metadata:
creationTimestamp: 2018-09-21T20:50:24Z
labels:
addonmanager.kubernetes.io/mode: EnsureExists
name: kube-dns
namespace: kube-system
data:
stubDomains: |
{"sandpit-09.local": ["10.128.0.5"]}
upstreamNameservers: |
["10.128.0.5", "8.8.8.8", "8.8.4.4"]
resourceVersion: "241"
selfLink: /api/v1/namespaces/kube-system/configmaps/kube-dns
uid: f64e8abd-bddf-11e8-a739-42010a800014
Apply K8 configuration
cloudshell:~/k8 (elastifile-sa)$ kubectl apply -f elfsDomains
Verify K8 configuration
cloudshell:~/k8 (elastifile-sa)$ kubectl -n kube-system get configmap kube-dns -oyaml
apiVersion: v1
kind: ConfigMap
metadata:
creationTimestamp: 2018-09-21T20:50:24Z
labels:
addonmanager.kubernetes.io/mode: EnsureExists
name: kube-dns
namespace: kube-system
data:
stubDomains: |
{"sandpit-09.local": ["10.128.0.5"]}
upstreamNameservers: |
["10.128.0.5", "8.8.8.8", "8.8.4.4"]
resourceVersion: "241"
selfLink: /api/v1/namespaces/kube-system/configmaps/kube-dns
uid: f64e8abd-bddf-11e8-a739-42010a800014
Create K8 PersistentVolume definition using Elastifile DNS name and NFS export
@cloudshell:~/k8 (elastifile-sa)$ cat pv-nfs.yml
apiVersion: v1
kind: PersistentVolume
metadata:
name: nfs
spec:
capacity:
storage: 10Gi
accessModes:
- ReadWriteMany
nfs:
server: sandpit-09.local
# Exported path of your NFS server
path: "/DC01/root"
Create K8 PersistentVolume Claim for NFS
@cloudshell:~/k8 (elastifile-sa)$ cat pvc-nfs.yml
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: nfs
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: 10Gi
storageClassName: ""
Apply K8 configuration for PersistentVolume and Claim
@cloudshell:~/k8 (elastifile-sa)$ kubectl create -f pv-nfs.yml && kubectl create -f pvc-nfs.yml
persistentvolume "nfs" created
persistentvolumeclaim "nfs" created