Encrypt PVCs using CSI and Kubernetes Secrets in GKE
This article discusses the PVC encryption methods used with the Kubernetes Container Storage Interface. For details about using Portworx with CSI, refer to the Portworx with CSI page.
Prerequisites
In order to perform the steps in this document, you must have Portworx with CSI enabled.
Encrypt your volumes
You can encrypt your volumes in one of two ways:
- Per StorageClass
- Per PVC
Encrypt your volumes per StorageClass
You can encrypt your volumes by specifying the encryption key in a Kubernetes secret. This secret can be same as the one created to host the authentication token. Using this method, you can handle both authentication and encryption together, and multiple PVCs referring to this storage class can use the same secret for encryption.
Step 1: Create a Kubernetes secret that contains the passphrase used for encrypting the Portworx volume
Enter the following command, specifying your own passphrase in mysecret-passcode-for-encryption, which encrypts the PVC:
kubectl create secret generic volume-secrets -n kube-system --from-literal=mysql-pvc-secret-key=<mysecret-passcode-for-encryption>