Skip to content

Commit

Permalink
docs: add faq
Browse files Browse the repository at this point in the history
Add fast answers to common questions

Signed-off-by: Serge Logvinov <[email protected]>
  • Loading branch information
sergelogvinov committed Oct 2, 2024
1 parent 0cd72b0 commit 2f34870
Show file tree
Hide file tree
Showing 2 changed files with 80 additions and 0 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,10 @@ spec:
- topology.kubernetes.io/zone
```

## FAQ

See [FAQ](docs/faq.md) for answers to common questions.

## Resources

* https://arslan.io/2018/06/21/how-to-write-a-container-storage-interface-csi-plugin/
Expand Down
76 changes: 76 additions & 0 deletions docs/faq.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# Fast answers to common questions

## Create a PVC with already existing disk

If you have a disk already created in Proxmox, you can use it with the CSI plugin.
First, you need to create a PV/PVC with the disk name and the storage class name.
The size of the PersistentVolume must be the same as the disk size.

```yaml
apiVersion: v1
kind: PersistentVolume
metadata:
name: pvc-test
spec:
accessModes:
- ReadWriteOnce
capacity:
storage: 10Gi
csi:
driver: csi.proxmox.sinextra.dev
fsType: xfs
volumeAttributes:
storage: zfs
volumeHandle: dev-1/pve-m-4/zfs/vm-100-disk-1
storageClassName: proxmox-zfs
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: storage-test-0
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Gi
storageClassName: proxmox-zfs
volumeName: pvc-test
```
The disk name is `vm-100-disk-1`, and the storage class name is `proxmox-zfs`.

## How to change the disk secret key?

The secret key cannot be change through kubernetes API, but you can use the following instructions.
Before starting, read the good explanation of the [cryptsetup](https://wiki.archlinux.org/title/Dm-crypt/Device_encryption) tool.

First, you need to run the pod with secured PVC, then you need to define the csi-plugin pod running on the same node as the pod with the PVC.

Lets say the csi-plugin pod name is `proxmox-csi-plugin-node-hjchn` and `/dev/sdb` is the disk you want to change the secret key for.

```shell
# Check the disk
kubectl -n csi-proxmox exec -ti proxmox-csi-plugin-node-hjchn -- /sbin/cryptsetup luksDump /dev/sdb
# Check the passphrase
kubectl -n csi-proxmox exec -ti proxmox-csi-plugin-node-hjchn -- /sbin/cryptsetup luksOpen --test-passphrase -v /dev/sdb
```

Add the new passphrase to the disk

```shell
# Add the new passphrase
kubectl -n csi-proxmox exec -ti proxmox-csi-plugin-node-hjchn -- /sbin/cryptsetup luksAddKey /dev/sdb
# Check the new passphrase
kubectl -n csi-proxmox exec -ti proxmox-csi-plugin-node-hjchn -- /sbin/cryptsetup luksOpen --test-passphrase -v /dev/sdb
# Check the disk
kubectl -n csi-proxmox exec -ti proxmox-csi-plugin-node-hjchn -- /sbin/cryptsetup luksDump /dev/sdb
```

After you have added the new passphrase, you can remove the old one.
And change the passphrase in kubernetes secret resource.

```shell
# Remove the old passphrase
kubectl -n csi-proxmox exec -ti proxmox-csi-plugin-node-hjchn -- /sbin/cryptsetup luksRemoveKey /dev/sdb
```

0 comments on commit 2f34870

Please sign in to comment.