kubeasz/roles/cluster-storage/templates/nfs/nfs-client-provisioner.yaml.j2

88 lines
2.3 KiB
Django/Jinja

apiVersion: v1
kind: ServiceAccount
metadata:
name: nfs-client-provisioner
namespace: kube-system
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: nfs-client-provisioner-runner
rules:
- 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: ["list", "watch", "create", "update", "patch"]
---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: run-nfs-client-provisioner
subjects:
- kind: ServiceAccount
name: nfs-client-provisioner
namespace: kube-system
roleRef:
kind: ClusterRole
name: nfs-client-provisioner-runner
apiGroup: rbac.authorization.k8s.io
---
kind: Deployment
apiVersion: apps/v1
metadata:
name: {{ storage.nfs.provisioner_name }}
namespace: kube-system
spec:
replicas: 1
strategy:
type: Recreate
selector:
matchLabels:
app: {{ storage.nfs.provisioner_name }}
template:
metadata:
labels:
app: {{ storage.nfs.provisioner_name }}
spec:
serviceAccountName: nfs-client-provisioner
containers:
- name: nfs-client-provisioner
#image: quay.io/external_storage/nfs-client-provisioner:latest
image: jmgao1983/nfs-client-provisioner:latest
imagePullPolicy: IfNotPresent
volumeMounts:
- name: nfs-client-root
mountPath: /persistentvolumes
env:
- name: PROVISIONER_NAME
# 此处供应者名字供storageclass调用
value: {{ storage.nfs.provisioner_name }}
- name: NFS_SERVER
value: {{ storage.nfs.server }}
- name: NFS_PATH
value: {{ storage.nfs.server_path }}
volumes:
- name: nfs-client-root
nfs:
server: {{ storage.nfs.server }}
path: {{ storage.nfs.server_path }}
---
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: {{ storage.nfs.storage_class }}
provisioner: {{ storage.nfs.provisioner_name }}