|
| 1 | ++++ |
| 2 | +title = "Encryption At Rest" |
| 3 | ++++ |
| 4 | + |
| 5 | +`encryptionAtRest` variable enables encrypting kubernetes resources at rest using provided encryption provider. |
| 6 | +When this variable is set, kuberntetes `secrets` and `configmap`s are encrypted before writing them at `etcd`. |
| 7 | + |
| 8 | +If the `encryptionAtRest` property is not specified, then |
| 9 | +the customization will be skipped. The `secrets` and `configmaps` will not be stored as encrypted in `etcd`. |
| 10 | + |
| 11 | +We support following encryption providers |
| 12 | + |
| 13 | +- aescbc |
| 14 | +- secretbox |
| 15 | + |
| 16 | +More information about encryption at-rest: [Encrypting Confidential Data at Rest |
| 17 | +](https://kubernetes.io/docs/tasks/administer-cluster/encrypt-data/) |
| 18 | + |
| 19 | +## Example |
| 20 | + |
| 21 | +To encrypt `configmaps` and `secrets` kubernetes resources using `aescbc` encryption provider: |
| 22 | + |
| 23 | +```yaml |
| 24 | +apiVersion: cluster.x-k8s.io/v1beta1 |
| 25 | +kind: Cluster |
| 26 | +metadata: |
| 27 | + name: <NAME> |
| 28 | +spec: |
| 29 | + topology: |
| 30 | + variables: |
| 31 | + - name: clusterConfig |
| 32 | + value: |
| 33 | + encryptionAtRest: |
| 34 | + providers: |
| 35 | + - aescbc: {} |
| 36 | +``` |
| 37 | +
|
| 38 | +Applying this configuration will result in |
| 39 | +
|
| 40 | +1. `<CLUSTER_NAME>-encryption-config` secret generated. |
| 41 | + |
| 42 | + A secret key for the encryption provider is generated and stored in `<CLUSTER_NAME>-encryption-config` secret. |
| 43 | + The APIServer will be configured to use the secret key to encrypt `secrets` and |
| 44 | + `configmaps` kubernetes resources before writing them to etcd. |
| 45 | + When reading resources from `etcd`, encryption provider that matches the stored data attempts in order to decrypt the data. |
| 46 | + CAREN currently does not rotate the key once it generated. |
| 47 | + |
| 48 | +1. Configure APIServer with encryption configuration: |
| 49 | + |
| 50 | +- `KubeadmControlPlaneTemplate`: |
| 51 | + |
| 52 | + ```yaml |
| 53 | + spec: |
| 54 | + kubeadmConfigSpec: |
| 55 | + clusterConfiguration: |
| 56 | + apiServer: |
| 57 | + extraArgs: |
| 58 | + encryption-provider-config: /etc/kubernetes/pki/encryptionconfig.yaml |
| 59 | + files: |
| 60 | + - contentFrom: |
| 61 | + secret: |
| 62 | + key: config |
| 63 | + name: <CLUSTER_NAME>-encryption-config |
| 64 | + path: /etc/kubernetes/pki/encryptionconfig.yaml |
| 65 | + permissions: "0640" |
| 66 | + ``` |
0 commit comments