Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add connection to Hetzner storage box for ReadWriteMany + cheaper storage then SSD #37

Open
aptroost opened this issue Oct 20, 2022 · 0 comments

Comments

@aptroost
Copy link

aptroost commented Oct 20, 2022

Example using Samba, but requires manual creating of storage box.
After generating storage box, the $HETZNER_STORAGE_USER is the id of your storage box.
You have to create a password for that specific storage box and use it as $HETZNER_STORAGE_PASSWORD

source: https://github.com/kubernetes-csi/csi-driver-smb

helm repo add csi-driver-smb https://raw.githubusercontent.com/kubernetes-csi/csi-driver-smb/master/charts
helm install csi-driver-smb csi-driver-smb/csi-driver-smb --namespace kube-system --version v1.9.0

Create secret

kubectl create secret generic smbcreds --from-literal username="$HETZNER_STORAGE_USER" \
--from-literal password="$HETZNER_STORAGE_PASSWORD"

smb.yaml:

---
apiVersion: v1
kind: PersistentVolume
metadata:
  name: pv-samba
spec:
  capacity:
    storage: 100Gi
  accessModes:
    - ReadWriteMany
  persistentVolumeReclaimPolicy: Retain
  storageClassName: smb
  mountOptions:
    - dir_mode=0777
    - file_mode=0777
  csi:
    driver: smb.csi.k8s.io
    readOnly: false
    volumeHandle: unique-samba  # make sure it's a unique id in the cluster
    volumeAttributes:
      source: "//$HETZNER_STORAGE_USER.your-storagebox.de/backup"
    nodeStageSecretRef:
      name: smbcreds

---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: pvc-samba
spec:
  accessModes:
    - ReadWriteMany
  resources:
    requests:
      storage: 100Gi
  volumeName: pv-samba
  storageClassName: smb

Deploy smb.yaml:

kubectl create -f smb.yaml

usage in deployment:

volumes:
  - name: hetzner-storage
    persistentVolumeClaim:
      claimName: pvc-samba
@aptroost aptroost changed the title Add connection to Hetzner storage box using Samba Add connection to Hetzner storage box Oct 20, 2022
@aptroost aptroost changed the title Add connection to Hetzner storage box Add connection to Hetzner storage box for ReadWriteMany + cheap storage Oct 20, 2022
@aptroost aptroost changed the title Add connection to Hetzner storage box for ReadWriteMany + cheap storage Add connection to Hetzner storage box for ReadWriteMany + cheaper storage than SSD Oct 20, 2022
@aptroost aptroost changed the title Add connection to Hetzner storage box for ReadWriteMany + cheaper storage than SSD Add connection to Hetzner storage box for ReadWriteMany + cheaper storage then SSD Oct 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant