|
| 1 | +apiVersion: v1 |
| 2 | +kind: ServiceAccount |
| 3 | +metadata: |
| 4 | + name: local-path-provisioner-service-account |
| 5 | + namespace: kube-system |
| 6 | +--- |
| 7 | +apiVersion: rbac.authorization.k8s.io/v1 |
| 8 | +kind: ClusterRole |
| 9 | +metadata: |
| 10 | + name: local-path-provisioner-role |
| 11 | +rules: |
| 12 | + - apiGroups: [""] |
| 13 | + resources: ["nodes", "persistentvolumeclaims", "configmaps", "pods/log"] |
| 14 | + verbs: ["get", "list", "watch"] |
| 15 | + - apiGroups: [""] |
| 16 | + resources: ["endpoints", "persistentvolumes", "pods"] |
| 17 | + verbs: ["*"] |
| 18 | + - apiGroups: [""] |
| 19 | + resources: ["events"] |
| 20 | + verbs: ["create", "patch"] |
| 21 | + - apiGroups: ["storage.k8s.io"] |
| 22 | + resources: ["storageclasses"] |
| 23 | + verbs: ["get", "list", "watch"] |
| 24 | +--- |
| 25 | +apiVersion: rbac.authorization.k8s.io/v1 |
| 26 | +kind: ClusterRoleBinding |
| 27 | +metadata: |
| 28 | + name: local-path-provisioner-bind |
| 29 | +roleRef: |
| 30 | + apiGroup: rbac.authorization.k8s.io |
| 31 | + kind: ClusterRole |
| 32 | + name: local-path-provisioner-role |
| 33 | +subjects: |
| 34 | + - kind: ServiceAccount |
| 35 | + name: local-path-provisioner-service-account |
| 36 | + namespace: kube-system |
| 37 | +--- |
| 38 | +apiVersion: apps/v1 |
| 39 | +kind: Deployment |
| 40 | +metadata: |
| 41 | + name: local-path-provisioner |
| 42 | + namespace: kube-system |
| 43 | +spec: |
| 44 | + revisionHistoryLimit: 0 |
| 45 | + strategy: |
| 46 | + type: RollingUpdate |
| 47 | + rollingUpdate: |
| 48 | + maxUnavailable: 1 |
| 49 | + selector: |
| 50 | + matchLabels: |
| 51 | + app: local-path-provisioner |
| 52 | + template: |
| 53 | + metadata: |
| 54 | + labels: |
| 55 | + app: local-path-provisioner |
| 56 | + spec: |
| 57 | + priorityClassName: "system-node-critical" |
| 58 | + serviceAccountName: local-path-provisioner-service-account |
| 59 | + tolerations: |
| 60 | + - key: "CriticalAddonsOnly" |
| 61 | + operator: "Exists" |
| 62 | + nodeSelector: |
| 63 | + local-storage: "true" |
| 64 | + containers: |
| 65 | + - name: local-path-provisioner |
| 66 | + image: rancher/local-path-provisioner:v0.0.28 |
| 67 | + imagePullPolicy: IfNotPresent |
| 68 | + command: |
| 69 | + - local-path-provisioner |
| 70 | + - start |
| 71 | + - --config |
| 72 | + - /etc/config/config.json |
| 73 | + volumeMounts: |
| 74 | + - name: config-volume |
| 75 | + mountPath: /etc/config/ |
| 76 | + env: |
| 77 | + - name: POD_NAMESPACE |
| 78 | + valueFrom: |
| 79 | + fieldRef: |
| 80 | + fieldPath: metadata.namespace |
| 81 | + volumes: |
| 82 | + - name: config-volume |
| 83 | + configMap: |
| 84 | + name: local-path-config |
| 85 | +--- |
| 86 | +apiVersion: storage.k8s.io/v1 |
| 87 | +kind: StorageClass |
| 88 | +metadata: |
| 89 | + name: local-path |
| 90 | + annotations: |
| 91 | + defaultVolumeType: "local" |
| 92 | + storageclass.kubernetes.io/is-default-class: "true" |
| 93 | +provisioner: rancher.io/local-path |
| 94 | +volumeBindingMode: WaitForFirstConsumer |
| 95 | +reclaimPolicy: Delete |
| 96 | +--- |
| 97 | +kind: ConfigMap |
| 98 | +apiVersion: v1 |
| 99 | +metadata: |
| 100 | + name: local-path-config |
| 101 | + namespace: kube-system |
| 102 | +data: |
| 103 | + config.json: |- |
| 104 | + { |
| 105 | + "nodePathMap":[ |
| 106 | + { |
| 107 | + "node":"DEFAULT_PATH_FOR_NON_LISTED_NODES", |
| 108 | + "paths":["/var/lib/mesh/data/k3s/storage"] |
| 109 | + } |
| 110 | + ] |
| 111 | + } |
| 112 | + setup: |- |
| 113 | + #!/bin/sh |
| 114 | + set -eu |
| 115 | + mkdir -m 0777 -p "${VOL_DIR}" |
| 116 | + chmod 700 "${VOL_DIR}/.." |
| 117 | + teardown: |- |
| 118 | + #!/bin/sh |
| 119 | + set -eu |
| 120 | + rm -rf "${VOL_DIR}" |
| 121 | + helperPod.yaml: |- |
| 122 | + apiVersion: v1 |
| 123 | + kind: Pod |
| 124 | + metadata: |
| 125 | + name: helper-pod |
| 126 | + spec: |
| 127 | + containers: |
| 128 | + - name: helper-pod |
| 129 | + image: "rancher/mirrored-library-busybox:1.36.1" |
| 130 | + imagePullPolicy: IfNotPresent |
0 commit comments