enable storageclass to the synology

This commit is contained in:
2024-11-04 23:51:32 +00:00
parent d6f792b054
commit f370ae2977
6 changed files with 138 additions and 0 deletions
+8
View File
@@ -0,0 +1,8 @@
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: nfs-storage-infrequentaccess
provisioner: k8s-sigs.io/nfs-subdir-external-provisioner-infrequentaccess # or choose another name, must match deployment's env PROVISIONER_NAME'
parameters:
archiveOnDelete: "false"
pathPattern: "${.PVC.annotations.fileType}/${.PVC.namespace}/${.PVC.name}"
@@ -0,0 +1,39 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: nfs-client-provisioner
labels:
app: nfs-client-provisioner
# replace with namespace where provisioner is deployed
namespace: nfs-provisioner-synology
spec:
replicas: 1
strategy:
type: Recreate
selector:
matchLabels:
app: nfs-client-provisioner
template:
metadata:
labels:
app: nfs-client-provisioner
spec:
serviceAccountName: nfs-client-provisioner-infrequentaccess
containers:
- name: nfs-client-provisioner
image: registry.k8s.io/sig-storage/nfs-subdir-external-provisioner:v4.0.2
volumeMounts:
- name: nfs-client-root
mountPath: /persistentvolumes
env:
- name: PROVISIONER_NAME
value: k8s-sigs.io/nfs-subdir-external-provisioner-infrequentaccess
- name: NFS_SERVER
value: 192.168.88.39
- name: NFS_PATH
value: /volume2/kubernetes
volumes:
- name: nfs-client-root
nfs:
server: 192.168.88.39
path: /volume2/kubernetes
@@ -0,0 +1,4 @@
resources:
- class.yaml
- rbac.yaml
- deployment.yaml
@@ -0,0 +1,5 @@
# namespace.yaml
apiVersion: v1
kind: Namespace
metadata:
name: nfs-provisioner-synology
+68
View File
@@ -0,0 +1,68 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: nfs-client-provisioner-infrequentaccess
# replace with namespace where provisioner is deployed
namespace: nfs-provisioner-synology
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: nfs-client-provisioner-runner
rules:
- apiGroups: [""]
resources: ["nodes"]
verbs: ["get", "list", "watch"]
- apiGroups: [""]
resources: ["persistentvolumes"]
verbs: ["get", "list", "watch", "create", "delete"]
- apiGroups: [""]
resources: ["persistentvolumeclaims"]
verbs: ["get", "list", "watch", "update"]
- apiGroups: ["storage.k8s.io"]
resources: ["storageclasses"]
verbs: ["get", "list", "watch"]
- apiGroups: [""]
resources: ["events"]
verbs: ["create", "update", "patch"]
---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: run-nfs-client-provisioner-infrequentaccess
subjects:
- kind: ServiceAccount
name: nfs-client-provisioner-infrequentaccess
# replace with namespace where provisioner is deployed
namespace: nfs-provisioner-synology
roleRef:
kind: ClusterRole
name: nfs-client-provisioner-runner
apiGroup: rbac.authorization.k8s.io
---
kind: Role
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: leader-locking-nfs-client-provisioner
# replace with namespace where provisioner is deployed
namespace: nfs-provisioner-synology
rules:
- apiGroups: [""]
resources: ["endpoints"]
verbs: ["get", "list", "watch", "create", "update", "patch"]
---
kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: leader-locking-nfs-client-provisioner
# replace with namespace where provisioner is deployed
namespace: nfs-provisioner-synology
subjects:
- kind: ServiceAccount
name: nfs-client-provisioner-infrequentaccess
# replace with namespace where provisioner is deployed
namespace: nfs-provisioner-synology
roleRef:
kind: Role
name: leader-locking-nfs-client-provisioner
apiGroup: rbac.authorization.k8s.io
@@ -0,0 +1,14 @@
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: test-claim
annotations:
fileType : "Backup"
spec:
storageClassName: nfs-storage-infrequentaccess
accessModes:
- ReadWriteMany
resources:
requests:
storage: 1Mi
---