storage: add a linode-local StorageClass + provisioner (local-path-linode) #30
2 changed files with 123 additions and 0 deletions
|
|
@ -2,3 +2,4 @@ apiVersion: kustomize.config.k8s.io/v1beta1
|
||||||
kind: Kustomization
|
kind: Kustomization
|
||||||
resources:
|
resources:
|
||||||
- local-path-storage.yaml
|
- local-path-storage.yaml
|
||||||
|
- local-path-linode.yaml
|
||||||
|
|
|
||||||
122
infrastructure/storage/local-path-linode.yaml
Normal file
122
infrastructure/storage/local-path-linode.yaml
Normal file
|
|
@ -0,0 +1,122 @@
|
||||||
|
# Second local-path provisioner, pinned to the `linode` worker.
|
||||||
|
#
|
||||||
|
# The original `local-path` StorageClass keeps its single-replica provisioner on
|
||||||
|
# siriussec (and its helper pod pinned there), so a PVC consumed by a pod on
|
||||||
|
# linode would have its directory created on the ThinkPad's disk. This file adds
|
||||||
|
# an independent provisioner + StorageClass whose volumes live on linode's own
|
||||||
|
# disk. `local-path` remains the cluster default; nothing here touches it.
|
||||||
|
#
|
||||||
|
# Volumes land under /opt/local-path-provisioner/pvc-<uuid>_<ns>_<pvc> on linode.
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: ConfigMap
|
||||||
|
metadata:
|
||||||
|
name: local-path-config-linode
|
||||||
|
namespace: local-path-storage
|
||||||
|
data:
|
||||||
|
config.json: |-
|
||||||
|
{
|
||||||
|
"nodePathMap":[
|
||||||
|
{
|
||||||
|
"node":"DEFAULT_PATH_FOR_NON_LISTED_NODES",
|
||||||
|
"paths":["/opt/local-path-provisioner"]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"node":"linode",
|
||||||
|
"paths":["/opt/local-path-provisioner"]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
setup: |-
|
||||||
|
#!/bin/sh
|
||||||
|
set -eu
|
||||||
|
mkdir -m 0777 -p "$VOL_DIR"
|
||||||
|
teardown: |-
|
||||||
|
#!/bin/sh
|
||||||
|
set -eu
|
||||||
|
rm -rf "$VOL_DIR"
|
||||||
|
helperPod.yaml: |-
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Pod
|
||||||
|
metadata:
|
||||||
|
name: helper-pod
|
||||||
|
spec:
|
||||||
|
priorityClassName: system-node-critical
|
||||||
|
nodeSelector:
|
||||||
|
kubernetes.io/hostname: linode
|
||||||
|
tolerations:
|
||||||
|
- key: node.kubernetes.io/disk-pressure
|
||||||
|
operator: Exists
|
||||||
|
effect: NoSchedule
|
||||||
|
- key: dedicated
|
||||||
|
operator: Equal
|
||||||
|
value: network
|
||||||
|
effect: PreferNoSchedule
|
||||||
|
containers:
|
||||||
|
- name: helper-pod
|
||||||
|
image: busybox
|
||||||
|
imagePullPolicy: IfNotPresent
|
||||||
|
---
|
||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: local-path-provisioner-linode
|
||||||
|
namespace: local-path-storage
|
||||||
|
spec:
|
||||||
|
replicas: 1
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: local-path-provisioner-linode
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: local-path-provisioner-linode
|
||||||
|
spec:
|
||||||
|
serviceAccountName: local-path-provisioner-service-account
|
||||||
|
nodeSelector:
|
||||||
|
kubernetes.io/hostname: linode
|
||||||
|
tolerations:
|
||||||
|
- key: dedicated
|
||||||
|
operator: Equal
|
||||||
|
value: network
|
||||||
|
effect: PreferNoSchedule
|
||||||
|
containers:
|
||||||
|
- name: local-path-provisioner
|
||||||
|
image: rancher/local-path-provisioner:v0.0.31
|
||||||
|
imagePullPolicy: IfNotPresent
|
||||||
|
command:
|
||||||
|
- local-path-provisioner
|
||||||
|
- --debug
|
||||||
|
- start
|
||||||
|
- --config
|
||||||
|
- /etc/config/config.json
|
||||||
|
- --provisioner-name
|
||||||
|
- rancher.io/local-path-linode
|
||||||
|
- --configmap-name
|
||||||
|
- local-path-config-linode
|
||||||
|
volumeMounts:
|
||||||
|
- name: config-volume
|
||||||
|
mountPath: /etc/config/
|
||||||
|
env:
|
||||||
|
- name: POD_NAMESPACE
|
||||||
|
valueFrom:
|
||||||
|
fieldRef:
|
||||||
|
fieldPath: metadata.namespace
|
||||||
|
- name: CONFIG_MOUNT_PATH
|
||||||
|
value: /etc/config/
|
||||||
|
- name: KUBERNETES_SERVICE_HOST
|
||||||
|
value: "10.10.0.2"
|
||||||
|
- name: KUBERNETES_SERVICE_PORT
|
||||||
|
value: "6443"
|
||||||
|
volumes:
|
||||||
|
- name: config-volume
|
||||||
|
configMap:
|
||||||
|
name: local-path-config-linode
|
||||||
|
---
|
||||||
|
apiVersion: storage.k8s.io/v1
|
||||||
|
kind: StorageClass
|
||||||
|
metadata:
|
||||||
|
name: local-path-linode
|
||||||
|
provisioner: rancher.io/local-path-linode
|
||||||
|
volumeBindingMode: WaitForFirstConsumer
|
||||||
|
reclaimPolicy: Delete
|
||||||
Loading…
Reference in a new issue