solidnerd / terraform-k8s-hcloud

A simple project to spin your k8s cluster with terraform, kubeadm on hcloud
MIT License
89 stars 37 forks source link

add hcloud csi driver volume support #25

Open anon6789 opened 4 years ago

anon6789 commented 4 years ago

This PR adds support for persistent volumes in kubernetes using the csi-driver. Feature mentioned here.

To test set csi_driver_enabled = true and use the following snippet*:

cat <<EOF | kubectl apply -f -
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: csi-pvc
spec:
  accessModes:
  - ReadWriteOnce
  resources:
    requests:
      storage: 10Gi
  storageClassName: hcloud-volumes
---
kind: Pod
apiVersion: v1
metadata:
  name: my-csi-app
spec:
  containers:
    - name: my-frontend
      image: busybox
      volumeMounts:
      - mountPath: "/data"
        name: my-csi-volume
      command: [ "sleep", "1000000" ]
  volumes:
    - name: my-csi-volume
      persistentVolumeClaim:
        claimName: csi-pvc
EOF

*from here

Then monitor the pod, the pvc and the volumes in hcloud dashboard.