kubernetes pv and pvc

This commit is contained in:
xcad2k 2021-11-05 10:37:42 +01:00
parent 66d63709bd
commit 0a53867d87
6 changed files with 116 additions and 0 deletions

View File

@ -0,0 +1,11 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: civo
spec:
accessModes:
- ReadWriteOnce
storageClassName: civo-volume
resources:
requests:
storage: 1Gi

View File

@ -0,0 +1,27 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: civo-web
spec:
replicas: 1
selector:
matchLabels:
app: civo-web
template:
metadata:
labels:
app: civo-web
spec:
containers:
- name: civo-web
image: nginx
ports:
- name: web
containerPort: 80
volumeMounts:
- name: civo
mountPath: "/usr/share/nginx/html"
volumes:
- name: civo
persistentVolumeClaim:
claimName: civo

View File

@ -0,0 +1,27 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: local-web
spec:
replicas: 1
selector:
matchLabels:
app: local-web
template:
metadata:
labels:
app: local-web
spec:
containers:
- name: local-web
image: nginx
ports:
- name: web
containerPort: 80
volumeMounts:
- name: local
mountPath: "/usr/share/nginx/html"
volumes:
- name: local
hostPath:
path: /usr/share/nginx/html

View File

@ -0,0 +1,13 @@
apiVersion: v1
kind: PersistentVolume
metadata:
name: nfs
spec:
capacity:
storage: 500Mi
accessModes:
- ReadWriteMany
storageClassName: nfs
nfs:
server: 192.168.1.7
path: "/srv/nfs"

View File

@ -0,0 +1,11 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: nfs
spec:
accessModes:
- ReadWriteMany
storageClassName: nfs
resources:
requests:
storage: 100Mi

View File

@ -0,0 +1,27 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: nfs-web
spec:
replicas: 1
selector:
matchLabels:
app: nfs-web
template:
metadata:
labels:
app: nfs-web
spec:
containers:
- name: nfs-web
image: nginx
ports:
- name: web
containerPort: 80
volumeMounts:
- name: nfs
mountPath: "/usr/share/nginx/html"
volumes:
- name: nfs
persistentVolumeClaim:
claimName: nfs