
Setup a NFS server in one of the node of Kubernetes Cluster using rhel 7.X
--------------------------------------------------------------------
$ yum update
$ rpm -qa | grep nfs-utils
$ yum install nfs-utils rpcbind
$ systemctl enable nfs-server
$ systemctl enable rpcbind
$ systemctl enable nfs-lock
$ systemctl enable nfs-idmap
$ systemctl start rpcbind
$ systemctl start nfs-server
$ systemctl start nfs-lock
$ systemctl start nfs-idmap
$ systemctl status nfs
$ mkdir /tecnotree
$ chmod 1777 /tecnotree
$ vi /etc/exports
------------------
/tecnotree *(rw)
exportfs -r
systemctl restart nfs-server
showmount -e
Validate NFS server is working Manually
--------------------------------------------------------------------
rpm -qa | grep nfs-utils
yum install nfs-utils
mkdir /tmp/mylocal
sudo mount -t nfs -o ro,nosuid 172.31.26.152:/tecnotree /tmp/mylocal
mkdir /tmp/mylocal1
sudo mount -t nfs -o rw,nosuid 172.31.26.152:/tecnotree /tmp/mylocal1
vi /etc/fstab
172.31.26.152:/tecnotree /tmp/mylocal nfs ro,nosuid 0 0
172.31.26.152:/tecnotree /tmp/mylocal1 nfs rw,nosuid 0 0
Using NFS server in Kubernetes Pods
apiVersion: apps/v1 | |
kind: Deployment | |
metadata: | |
annotations: | |
deployment.kubernetes.io/revision: "1" | |
creationTimestamp: null | |
generation: 1 | |
labels: | |
app: my-dep | |
name: my-dep1 | |
selfLink: /apis/apps/v1/namespaces/default/deployments/my-dep | |
spec: | |
progressDeadlineSeconds: 600 | |
replicas: 30 | |
revisionHistoryLimit: 10 | |
selector: | |
matchLabels: | |
app: my-dep | |
strategy: | |
rollingUpdate: | |
maxSurge: 25% | |
maxUnavailable: 25% | |
type: RollingUpdate | |
template: | |
metadata: | |
creationTimestamp: null | |
labels: | |
app: my-dep | |
spec: | |
containers: | |
- image: scmgalaxy/nginx-devopsschoolv2 | |
imagePullPolicy: Always | |
name: nginx-devopsschoolv1 | |
volumeMounts: | |
- mountPath: /test-pd | |
name: test-volume | |
resources: {} | |
terminationMessagePath: /dev/termination-log | |
terminationMessagePolicy: File | |
volumes: | |
- name: test-volume | |
nfs: | |
server: 172.31.14.69 | |
path: /tecnotree | |
dnsPolicy: ClusterFirst | |
restartPolicy: Always | |
schedulerName: default-scheduler | |
securityContext: {} | |
terminationGracePeriodSeconds: 30 | |
status: {} |

















I’m a DevOps/SRE/DevSecOps/Cloud Expert passionate about sharing knowledge and experiences. I am working at Cotocus. I blog tech insights at DevOps School, travel stories at Holiday Landmark, stock market tips at Stocks Mantra, health and fitness guidance at My Medic Plus, product reviews at I reviewed , and SEO strategies at Wizbrand.
Please find my social handles as below;
Rajesh Kumar Personal Website
Rajesh Kumar at YOUTUBE
Rajesh Kumar at INSTAGRAM
Rajesh Kumar at X
Rajesh Kumar at FACEBOOK
Rajesh Kumar at LINKEDIN
Rajesh Kumar at PINTEREST
Rajesh Kumar at QUORA
Rajesh Kumar at WIZBRAND