--- apiVersion: v1 kind: Namespace metadata: name: local-storage --- apiVersion: v1 kind: ServiceAccount metadata: name: hostpath-provisioner namespace: local-storage --- kind: ClusterRole apiVersion: rbac.authorization.k8s.io/v1 metadata: name: hostpath-provisioner rules: - apiGroups: [""] resources: ["persistentvolumes"] verbs: ["get", "list", "watch", "create", "delete"] - apiGroups: [""] resources: ["persistentvolumeclaims"] verbs: ["get", "list", "watch"] - 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: hostpath-provisioner subjects: - kind: ServiceAccount name: hostpath-provisioner namespace: local-storage roleRef: kind: ClusterRole name: hostpath-provisioner apiGroup: rbac.authorization.k8s.io --- kind: Role apiVersion: rbac.authorization.k8s.io/v1 metadata: name: leader-locking-hostpath-provisioner namespace: local-storage rules: - apiGroups: [""] resources: ["endpoints"] verbs: ["get", "update", "patch"] - apiGroups: [""] resources: ["endpoints"] verbs: ["list", "watch", "create"] --- kind: RoleBinding apiVersion: rbac.authorization.k8s.io/v1 metadata: name: leader-locking-hostpath-provisioner namespace: local-storage subjects: - kind: ServiceAccount name: hostpath-provisioner namespace: local-storage roleRef: kind: Role name: leader-locking-hostpath-provisioner apiGroup: rbac.authorization.k8s.io --- apiVersion: apps/v1 kind: Deployment metadata: name: hostpath-provisioner namespace: local-storage labels: app: hostpath-provisioner spec: replicas: 3 selector: matchLabels: app: hostpath-provisioner template: metadata: labels: app: hostpath-provisioner spec: containers: - name: hostpath-provisioner image: mauilion/hostpath-provisioner:dev imagePullPolicy: "IfNotPresent" env: - name: NODE_NAME valueFrom: fieldRef: fieldPath: spec.nodeName volumeMounts: - name: pv-volume mountPath: /tmp/hostpath-provisioner resources: limits: cpu: 200m memory: 256Mi requests: cpu: 100m memory: 128Mi serviceAccountName: hostpath-provisioner volumes: - name: pv-volume hostPath: path: /tmp/hostpath-provisioner --- kind: StorageClass apiVersion: storage.k8s.io/v1 metadata: name: local-storage annotations: storageclass.kubernetes.io/is-default-class: "true" reclaimPolicy: Delete provisioner: example.com/hostpath --- kind: StorageClass apiVersion: storage.k8s.io/v1 metadata: name: vsan-default-storage-policy annotations: storageclass.kubernetes.io/is-default-class: "false" reclaimPolicy: Delete provisioner: example.com/hostpath