From 0a53867d879ae6d1639beb041515610c8539d1b7 Mon Sep 17 00:00:00 2001 From: xcad2k <28359525+xcad2k@users.noreply.github.com> Date: Fri, 5 Nov 2021 10:37:42 +0100 Subject: [PATCH] kubernetes pv and pvc --- kubernetes/templates/pv-and-pvc/civo-pvc.yml | 11 ++++++++ kubernetes/templates/pv-and-pvc/civo-web.yml | 27 +++++++++++++++++++ kubernetes/templates/pv-and-pvc/local-web.yml | 27 +++++++++++++++++++ kubernetes/templates/pv-and-pvc/nfs-pv.yml | 13 +++++++++ kubernetes/templates/pv-and-pvc/nfs-pvc.yml | 11 ++++++++ kubernetes/templates/pv-and-pvc/nfs-web.yml | 27 +++++++++++++++++++ 6 files changed, 116 insertions(+) create mode 100644 kubernetes/templates/pv-and-pvc/civo-pvc.yml create mode 100644 kubernetes/templates/pv-and-pvc/civo-web.yml create mode 100644 kubernetes/templates/pv-and-pvc/local-web.yml create mode 100644 kubernetes/templates/pv-and-pvc/nfs-pv.yml create mode 100644 kubernetes/templates/pv-and-pvc/nfs-pvc.yml create mode 100644 kubernetes/templates/pv-and-pvc/nfs-web.yml diff --git a/kubernetes/templates/pv-and-pvc/civo-pvc.yml b/kubernetes/templates/pv-and-pvc/civo-pvc.yml new file mode 100644 index 0000000..248bf7b --- /dev/null +++ b/kubernetes/templates/pv-and-pvc/civo-pvc.yml @@ -0,0 +1,11 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: civo +spec: + accessModes: + - ReadWriteOnce + storageClassName: civo-volume + resources: + requests: + storage: 1Gi \ No newline at end of file diff --git a/kubernetes/templates/pv-and-pvc/civo-web.yml b/kubernetes/templates/pv-and-pvc/civo-web.yml new file mode 100644 index 0000000..8bfa1d0 --- /dev/null +++ b/kubernetes/templates/pv-and-pvc/civo-web.yml @@ -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 \ No newline at end of file diff --git a/kubernetes/templates/pv-and-pvc/local-web.yml b/kubernetes/templates/pv-and-pvc/local-web.yml new file mode 100644 index 0000000..52b07c9 --- /dev/null +++ b/kubernetes/templates/pv-and-pvc/local-web.yml @@ -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 \ No newline at end of file diff --git a/kubernetes/templates/pv-and-pvc/nfs-pv.yml b/kubernetes/templates/pv-and-pvc/nfs-pv.yml new file mode 100644 index 0000000..43c8271 --- /dev/null +++ b/kubernetes/templates/pv-and-pvc/nfs-pv.yml @@ -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" \ No newline at end of file diff --git a/kubernetes/templates/pv-and-pvc/nfs-pvc.yml b/kubernetes/templates/pv-and-pvc/nfs-pvc.yml new file mode 100644 index 0000000..7e8cb5e --- /dev/null +++ b/kubernetes/templates/pv-and-pvc/nfs-pvc.yml @@ -0,0 +1,11 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: nfs +spec: + accessModes: + - ReadWriteMany + storageClassName: nfs + resources: + requests: + storage: 100Mi \ No newline at end of file diff --git a/kubernetes/templates/pv-and-pvc/nfs-web.yml b/kubernetes/templates/pv-and-pvc/nfs-web.yml new file mode 100644 index 0000000..66fb680 --- /dev/null +++ b/kubernetes/templates/pv-and-pvc/nfs-web.yml @@ -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