| Matthias Andreas Benkard | 05e482e | 2026-11-04 11:05:51 +0100 | [diff] [blame] | 1 | --- |
| 2 | apiVersion: apps/v1 |
| 3 | kind: Deployment |
| 4 | metadata: |
| 5 | annotations: |
| 6 | kubectl.kubernetes.io/last-applied-configuration: | |
| 7 | {"apiVersion":"apps/v1beta2","kind":"Deployment","metadata":{"annotations":{},"name":"local-path-provisioner","namespace":"local-path-storage"},"spec":{"replicas":1,"selector":{"matchLabels":{"app":"local-path-provisioner"}},"template":{"metadata":{"labels":{"app":"local-path-provisioner"}},"spec":{"containers":[{"command":["local-path-provisioner","--debug","start","--config","/etc/config/config.json"],"env":[{"name":"POD_NAMESPACE","valueFrom":{"fieldRef":{"fieldPath":"metadata.namespace"}}}],"image":"rancher/local-path-provisioner:v0.0.2","imagePullPolicy":"Always","name":"local-path-provisioner","volumeMounts":[{"mountPath":"/etc/config/","name":"config-volume"}]}],"serviceAccountName":"local-path-provisioner-service-account","volumes":[{"configMap":{"name":"local-path-config"},"name":"config-volume"}]}}}} |
| 8 | labels: |
| 9 | app: local-path-provisioner |
| 10 | name: local-path-provisioner |
| 11 | namespace: local-path-storage |
| 12 | spec: |
| 13 | progressDeadlineSeconds: 600 |
| 14 | replicas: 1 |
| 15 | revisionHistoryLimit: 10 |
| 16 | selector: |
| 17 | matchLabels: |
| 18 | app: local-path-provisioner |
| 19 | strategy: |
| 20 | rollingUpdate: |
| 21 | maxSurge: 25% |
| 22 | maxUnavailable: 25% |
| 23 | type: RollingUpdate |
| 24 | template: |
| 25 | metadata: |
| 26 | labels: |
| 27 | app: local-path-provisioner |
| 28 | spec: |
| 29 | containers: |
| 30 | - command: |
| 31 | - local-path-provisioner |
| 32 | - --debug |
| 33 | - start |
| 34 | - --config |
| 35 | - /etc/config/config.json |
| 36 | env: |
| 37 | - name: POD_NAMESPACE |
| 38 | valueFrom: |
| 39 | fieldRef: |
| 40 | apiVersion: v1 |
| 41 | fieldPath: metadata.namespace |
| 42 | image: rancher/local-path-provisioner:v0.0.19 |
| 43 | imagePullPolicy: Always |
| 44 | name: local-path-provisioner |
| 45 | resources: {} |
| 46 | terminationMessagePath: /dev/termination-log |
| 47 | terminationMessagePolicy: File |
| 48 | volumeMounts: |
| 49 | - mountPath: /etc/config/ |
| 50 | name: config-volume |
| 51 | dnsPolicy: ClusterFirst |
| 52 | restartPolicy: Always |
| 53 | schedulerName: default-scheduler |
| 54 | securityContext: {} |
| 55 | serviceAccount: local-path-provisioner-service-account |
| 56 | serviceAccountName: local-path-provisioner-service-account |
| 57 | terminationGracePeriodSeconds: 30 |
| 58 | volumes: |
| 59 | - configMap: |
| 60 | defaultMode: 420 |
| 61 | name: local-path-config |
| 62 | name: config-volume |
| 63 | --- |
| 64 | apiVersion: v1 |
| 65 | data: |
| 66 | config.json: |- |
| 67 | { |
| 68 | "nodePathMap":[ |
| 69 | { |
| 70 | "node":"DEFAULT_PATH_FOR_NON_LISTED_NODES", |
| 71 | "paths":["/var/k8s"] |
| 72 | } |
| 73 | ] |
| 74 | } |
| 75 | helperPod.yaml: "apiVersion: v1\nkind: Pod\nmetadata:\n name: helper-pod\nspec:\n containers:\n - name: helper-pod\n image: alpine\n securityContext:\n privileged: true\n volumeMounts:\n - name: dev\n subPath: zfs\n mountPath: /dev/zfs\n volumes:\n - name: dev\n hostPath:\n path: /dev\n\n " |
| 76 | setup: "#!/bin/sh\nwhile getopts \"m:s:p:\" opt\ndo\n case $opt in\n p)\n absolutePath=$OPTARG\n ;;\n s)\n sizeInBytes=$OPTARG\n ;;\n m)\n volMode=$OPTARG\n ;;\n esac\ndone\n\napk update\napk add zfs \n\nzfs create \"rpool${absolutePath}\"\nzfs mount \"rpool${absolutePath}\" || :\nchmod 0777 \"${absolutePath}\"" |
| 77 | teardown: |- |
| 78 | #!/bin/sh |
| 79 | while getopts "m:s:p:" opt |
| 80 | do |
| 81 | case $opt in |
| 82 | p) |
| 83 | absolutePath=$OPTARG |
| 84 | ;; |
| 85 | s) |
| 86 | sizeInBytes=$OPTARG |
| 87 | ;; |
| 88 | m) |
| 89 | volMode=$OPTARG |
| 90 | ;; |
| 91 | esac |
| 92 | done |
| 93 | |
| 94 | zfs set mountpoint=none "rpool${absolutePath}" |
| 95 | kind: ConfigMap |
| 96 | metadata: |
| 97 | annotations: |
| 98 | kubectl.kubernetes.io/last-applied-configuration: | |
| 99 | {"apiVersion":"v1","data":{"config.json":"{\n \"nodePathMap\":[\n {\n \"node\":\"DEFAULT_PATH_FOR_NON_LISTED_NODES\",\n \"paths\":[\"/var/k8s\"]\n }\n ]\n}"},"kind":"ConfigMap","metadata":{"annotations":{},"name":"local-path-config","namespace":"local-path-storage"}} |
| 100 | name: local-path-config |
| 101 | namespace: local-path-storage |
| 102 | --- |
| 103 | apiVersion: v1 |
| 104 | kind: ServiceAccount |
| 105 | metadata: |
| 106 | annotations: |
| 107 | kubectl.kubernetes.io/last-applied-configuration: | |
| 108 | {"apiVersion":"v1","kind":"ServiceAccount","metadata":{"annotations":{},"name":"local-path-provisioner-service-account","namespace":"local-path-storage"}} |
| 109 | name: local-path-provisioner-service-account |
| 110 | namespace: local-path-storage |
| 111 | --- |
| 112 | apiVersion: rbac.authorization.k8s.io/v1 |
| 113 | kind: RoleBinding |
| 114 | metadata: |
| 115 | name: local-path-provisioner:psp:default |
| 116 | namespace: local-path-storage |
| 117 | roleRef: |
| 118 | apiGroup: rbac.authorization.k8s.io |
| 119 | kind: ClusterRole |
| 120 | name: psp:default |
| 121 | subjects: |
| 122 | - kind: ServiceAccount |
| 123 | name: local-path-provisioner-service-account |
| 124 | namespace: local-path-storage |
| 125 | --- |
| 126 | apiVersion: rbac.authorization.k8s.io/v1 |
| 127 | kind: ClusterRole |
| 128 | metadata: |
| 129 | annotations: |
| 130 | kubectl.kubernetes.io/last-applied-configuration: | |
| 131 | {"apiVersion":"rbac.authorization.k8s.io/v1beta1","kind":"ClusterRole","metadata":{"annotations":{},"name":"local-path-provisioner-role"},"rules":[{"apiGroups":[""],"resources":["nodes","persistentvolumeclaims"],"verbs":["get","list","watch"]},{"apiGroups":[""],"resources":["endpoints","persistentvolumes","pods"],"verbs":["*"]},{"apiGroups":[""],"resources":["events"],"verbs":["create","patch"]},{"apiGroups":["storage.k8s.io"],"resources":["storageclasses"],"verbs":["get","list","watch"]}]} |
| 132 | name: local-path-provisioner-role |
| 133 | rules: |
| 134 | - apiGroups: |
| 135 | - "" |
| 136 | resources: |
| 137 | - nodes |
| 138 | - persistentvolumeclaims |
| 139 | - configmaps |
| 140 | verbs: |
| 141 | - get |
| 142 | - list |
| 143 | - watch |
| 144 | - apiGroups: |
| 145 | - "" |
| 146 | resources: |
| 147 | - endpoints |
| 148 | - persistentvolumes |
| 149 | - pods |
| 150 | verbs: |
| 151 | - '*' |
| 152 | - apiGroups: |
| 153 | - "" |
| 154 | resources: |
| 155 | - events |
| 156 | verbs: |
| 157 | - create |
| 158 | - patch |
| 159 | - apiGroups: |
| 160 | - storage.k8s.io |
| 161 | resources: |
| 162 | - storageclasses |
| 163 | verbs: |
| 164 | - get |
| 165 | - list |
| 166 | - watch |
| 167 | --- |
| 168 | apiVersion: rbac.authorization.k8s.io/v1 |
| 169 | kind: ClusterRoleBinding |
| 170 | metadata: |
| 171 | annotations: |
| 172 | kubectl.kubernetes.io/last-applied-configuration: | |
| 173 | {"apiVersion":"rbac.authorization.k8s.io/v1beta1","kind":"ClusterRoleBinding","metadata":{"annotations":{},"name":"local-path-provisioner-bind"},"roleRef":{"apiGroup":"rbac.authorization.k8s.io","kind":"ClusterRole","name":"local-path-provisioner-role"},"subjects":[{"kind":"ServiceAccount","name":"local-path-provisioner-service-account","namespace":"local-path-storage"}]} |
| 174 | name: local-path-provisioner-bind |
| 175 | roleRef: |
| 176 | apiGroup: rbac.authorization.k8s.io |
| 177 | kind: ClusterRole |
| 178 | name: local-path-provisioner-role |
| 179 | subjects: |
| 180 | - kind: ServiceAccount |
| 181 | name: local-path-provisioner-service-account |
| 182 | namespace: local-path-storage |
| 183 | --- |
| 184 | apiVersion: storage.k8s.io/v1 |
| 185 | kind: StorageClass |
| 186 | metadata: |
| 187 | annotations: |
| 188 | kubectl.kubernetes.io/last-applied-configuration: | |
| 189 | {"apiVersion":"storage.k8s.io/v1","kind":"StorageClass","metadata":{"annotations":{},"name":"local-path"},"provisioner":"rancher.io/local-path","reclaimPolicy":"Delete","volumeBindingMode":"WaitForFirstConsumer"} |
| 190 | name: local-path |
| 191 | provisioner: rancher.io/local-path |
| 192 | reclaimPolicy: Delete |
| 193 | volumeBindingMode: WaitForFirstConsumer |