|
| 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 | + - key: "node-role.kubernetes.io/control-plane" |
| 63 | + operator: "Exists" |
| 64 | + effect: "NoSchedule" |
| 65 | + - key: "node-role.kubernetes.io/master" |
| 66 | + operator: "Exists" |
| 67 | + effect: "NoSchedule" |
| 68 | + containers: |
| 69 | + - name: local-path-provisioner |
| 70 | + image: "rancher/local-path-provisioner:v0.0.27" |
| 71 | + imagePullPolicy: IfNotPresent |
| 72 | + command: |
| 73 | + - local-path-provisioner |
| 74 | + - start |
| 75 | + - --config |
| 76 | + - /etc/config/config.json |
| 77 | + volumeMounts: |
| 78 | + - name: config-volume |
| 79 | + mountPath: /etc/config/ |
| 80 | + env: |
| 81 | + - name: POD_NAMESPACE |
| 82 | + valueFrom: |
| 83 | + fieldRef: |
| 84 | + fieldPath: metadata.namespace |
| 85 | + volumes: |
| 86 | + - name: config-volume |
| 87 | + configMap: |
| 88 | + name: local-path-config |
| 89 | +--- |
| 90 | +apiVersion: storage.k8s.io/v1 |
| 91 | +kind: StorageClass |
| 92 | +metadata: |
| 93 | + name: local-path |
| 94 | + annotations: |
| 95 | + defaultVolumeType: "local" |
| 96 | + storageclass.kubernetes.io/is-default-class: "true" |
| 97 | +provisioner: rancher.io/local-path |
| 98 | +volumeBindingMode: WaitForFirstConsumer |
| 99 | +reclaimPolicy: Delete |
| 100 | +--- |
| 101 | +apiVersion: v1 |
| 102 | +kind: ConfigMap |
| 103 | +metadata: |
| 104 | + annotations: |
| 105 | + objectset.rio.cattle.io/owner-gvk: k3s.cattle.io/v1, Kind=Addon |
| 106 | + objectset.rio.cattle.io/owner-name: local-storage |
| 107 | + objectset.rio.cattle.io/owner-namespace: kube-system |
| 108 | + name: local-path-config |
| 109 | + namespace: kube-system |
| 110 | +data: |
| 111 | + config.json: |- |
| 112 | + { |
| 113 | + "nodePathMap": [ |
| 114 | + { |
| 115 | + "node": "DEFAULT_PATH_FOR_NON_LISTED_NODES", |
| 116 | + "paths": [ |
| 117 | + "/var/lib/rancher/k3s/storage" |
| 118 | + ] |
| 119 | + }, |
| 120 | + { |
| 121 | + "node": "bradley", |
| 122 | + "paths": [ |
| 123 | + "/mnt/raid0", |
| 124 | + "/mnt/raid1", |
| 125 | + "/var/lib/rancher/k3s/storage" |
| 126 | + ] |
| 127 | + }, |
| 128 | + { |
| 129 | + "node": "node0", |
| 130 | + "paths": [ |
| 131 | + "/mnt/raid1", |
| 132 | + "/var/lib/rancher/k3s/storage" |
| 133 | + ] |
| 134 | + }, |
| 135 | + { |
| 136 | + "node": "compufam", |
| 137 | + "paths": [ |
| 138 | + "/var/lib/rancher/k3s/storage" |
| 139 | + ] |
| 140 | + } |
| 141 | + ] |
| 142 | + } |
| 143 | + helperPod.yaml: |- |
| 144 | + apiVersion: v1 |
| 145 | + kind: Pod |
| 146 | + metadata: |
| 147 | + name: helper-pod |
| 148 | + spec: |
| 149 | + containers: |
| 150 | + - name: helper-pod |
| 151 | + image: "rancher/mirrored-library-busybox:1.36.1" |
| 152 | + imagePullPolicy: IfNotPresent |
| 153 | + setup: |- |
| 154 | + #!/bin/sh |
| 155 | + set -eu |
| 156 | + mkdir -m 0777 -p "${VOL_DIR}" |
| 157 | + chmod 700 "${VOL_DIR}" |
| 158 | + teardown: |- |
| 159 | + #!/bin/sh |
| 160 | + set -eu |
| 161 | + rm -rf "${VOL_DIR}" |
0 commit comments