Skip to content

Instantly share code, notes, and snippets.

@febri4n
Created July 24, 2024 01:42
Show Gist options
  • Save febri4n/2897e7930577b846f14ff08f287799ec to your computer and use it in GitHub Desktop.
Save febri4n/2897e7930577b846f14ff08f287799ec to your computer and use it in GitHub Desktop.
Nginx NFS
---
apiVersion: v1
kind: PersistentVolume
metadata:
name: nfs-pv
spec:
capacity:
storage: 1Gi
accessModes:
- ReadWriteMany
persistentVolumeReclaimPolicy: Retain
nfs:
server: #IP NFS Servernya
path: "" #Path NFSnya
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: nfs-pvc
spec:
accessModes:
- ReadWriteMany
storageClassName: ""
resources:
requests:
storage: 1Gi
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-nfs-deployment
spec:
replicas: 2
selector:
matchLabels:
app: nginx-nfs
template:
metadata:
labels:
app: nginx-nfs
spec:
containers:
- name: nginx
image: nginx:latest
ports:
- containerPort: 80
volumeMounts:
- name: nfs-volume
mountPath: /usr/share/nginx/html
volumes:
- name: nfs-volume
persistentVolumeClaim:
claimName: nfs-pvc
---
apiVersion: v1
kind: Service
metadata:
name: nginx-nfs-service
spec:
type: NodePort
ports:
- port: 80
targetPort: 80
nodePort: 30080
selector:
app: nginx-nfs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment