initial commit
This commit is contained in:
35
lp/nfs/README.md
Executable file
35
lp/nfs/README.md
Executable file
@@ -0,0 +1,35 @@
|
||||
NFS Installatie:
|
||||
================
|
||||
|
||||
helm repo add nfs-subdir-external-provisioner \
|
||||
https://kubernetes-sigs.github.io/nfs-subdir-external-provisioner
|
||||
|
||||
helm install -n nfs-provisioning --create-namespace nfs-subdir-external-provisioner \
|
||||
nfs-subdir-external-provisioner/nfs-subdir-external-provisioner \
|
||||
--set nfs.server=192.168.2.110 --set nfs.path=/opt/dynamic-storage
|
||||
|
||||
|
||||
Testen:
|
||||
|
||||
kubectl apply -f demo-pvc.yaml
|
||||
kubectl apply -f test-pod.yaml
|
||||
|
||||
|
||||
kubectl exec -it test-pod -n nfs-provisioning -- df -h
|
||||
|
||||
#nfs als default storage instellen:
|
||||
|
||||
kubectl get storageclass
|
||||
|
||||
NAME PROVISIONER RECLAIMPOLICY VOLUMEBINDINGMODE ALLOWVOLUMEEXPANSION AGE
|
||||
microk8s-hostpath microk8s.io/hostpath Delete WaitForFirstConsumer false 33m
|
||||
nfs-client cluster.local/nfs-subdir-external-provisioner Delete Immediate true 18m
|
||||
|
||||
|
||||
kubectl patch storageclass microk8s-hostpath -p \
|
||||
'{"metadata": \
|
||||
{"annotations":{"storageclass.kubernetes.io/is-default-class":"false"}}}'
|
||||
|
||||
kubectl patch storageclass nfs-client -p \
|
||||
'{"metadata": \
|
||||
{"annotations":{"storageclass.kubernetes.io/is-default-class":"true"}}}'
|
||||
11
lp/nfs/catalog-info.yaml
Normal file
11
lp/nfs/catalog-info.yaml
Normal file
@@ -0,0 +1,11 @@
|
||||
apiVersion: backstage.io/v1alpha1
|
||||
kind: Component
|
||||
metadata:
|
||||
name: lp-nfs
|
||||
title: Nfs (lp)
|
||||
spec:
|
||||
type: service
|
||||
lifecycle: production
|
||||
owner: platform-team
|
||||
partOf:
|
||||
- ../catalog-info.yaml
|
||||
12
lp/nfs/demo-pvc.yaml
Executable file
12
lp/nfs/demo-pvc.yaml
Executable file
@@ -0,0 +1,12 @@
|
||||
kind: PersistentVolumeClaim
|
||||
apiVersion: v1
|
||||
metadata:
|
||||
name: demo-claim
|
||||
namespace: nfs-provisioning
|
||||
spec:
|
||||
storageClassName: nfs-client
|
||||
accessModes:
|
||||
- ReadWriteMany
|
||||
resources:
|
||||
requests:
|
||||
storage: 10Mi
|
||||
18
lp/nfs/k3s/nfs.yaml
Executable file
18
lp/nfs/k3s/nfs.yaml
Executable file
@@ -0,0 +1,18 @@
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: nfs-provisioning
|
||||
---
|
||||
apiVersion: helm.cattle.io/v1
|
||||
kind: HelmChart
|
||||
metadata:
|
||||
name: nfs-provisioning
|
||||
namespace: kube-system
|
||||
spec:
|
||||
repo: https://kubernetes-sigs.github.io/nfs-subdir-external-provisioner
|
||||
chart: nfs-subdir-external-provisioner
|
||||
targetNamespace: nfs-provisioning
|
||||
valuesContent: |-
|
||||
nfs:
|
||||
server: 192.168.2.100
|
||||
path: /opt/dynamic-storage
|
||||
13
lp/nfs/nfs-storage-class.yaml
Normal file
13
lp/nfs/nfs-storage-class.yaml
Normal file
@@ -0,0 +1,13 @@
|
||||
apiVersion: storage.k8s.io/v1
|
||||
kind: StorageClass
|
||||
metadata:
|
||||
name: nfs-csi
|
||||
provisioner: nfs.csi.k8s.io
|
||||
parameters:
|
||||
server: 192.168.2.110
|
||||
share: /mnt/nfs_share/nfs-dynamic/
|
||||
reclaimPolicy: Delete
|
||||
volumeBindingMode: Immediate
|
||||
mountOptions:
|
||||
- hard
|
||||
- nfsvers=4.1
|
||||
29
lp/nfs/test-nfs.yaml
Executable file
29
lp/nfs/test-nfs.yaml
Executable file
@@ -0,0 +1,29 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: fedoratest
|
||||
labels:
|
||||
app: fedoratest
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: fedora
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: fedora
|
||||
spec:
|
||||
containers:
|
||||
- name: fedora
|
||||
image: fedora
|
||||
command: ["/bin/bash", "-c", "--"]
|
||||
args: ["while true; do sleep 30; done;"]
|
||||
volumeMounts:
|
||||
- name: nfs-vol
|
||||
mountPath: /opt/nfs
|
||||
volumes:
|
||||
- name: nfs-vol
|
||||
nfs:
|
||||
server: 192.168.40.100
|
||||
path: /mnt/nfs_share
|
||||
22
lp/nfs/test-pod.yaml
Executable file
22
lp/nfs/test-pod.yaml
Executable file
@@ -0,0 +1,22 @@
|
||||
kind: Pod
|
||||
apiVersion: v1
|
||||
metadata:
|
||||
name: test-pod
|
||||
namespace: nfs-provisioning
|
||||
spec:
|
||||
containers:
|
||||
- name: test-pod
|
||||
image: busybox:latest
|
||||
command:
|
||||
- "/bin/sh"
|
||||
args:
|
||||
- "-c"
|
||||
- "touch /mnt/SUCCESS && sleep 600"
|
||||
volumeMounts:
|
||||
- name: nfs-pvc
|
||||
mountPath: "/mnt"
|
||||
restartPolicy: "Never"
|
||||
volumes:
|
||||
- name: nfs-pvc
|
||||
persistentVolumeClaim:
|
||||
claimName: demo-claim
|
||||
Reference in New Issue
Block a user