@@ -386,20 +386,32 @@ Your config file contains keys that can decrypt the contents in etcd, so you mus
386
386
permissions on your control-plane nodes so only the user who runs the `kube-apiserver` can read it.
387
387
{{< /caution >}}
388
388
389
- # # Verifying that data is encrypted
389
+ # ## Reconfigure other control plane hosts {#api-server-config-update-more}
390
390
391
- Data is encrypted when written to etcd. After restarting your `kube-apiserver`, any newly created or
392
- updated Secret or other resource types configured in `EncryptionConfiguration` should be encrypted
393
- when stored. To check this, you can use the `etcdctl` command line
391
+ If you have multiple API servers in your cluster, you should deploy the
392
+ changes in turn to each API server.
393
+
394
+ Make sure that you use the **same** encryption configuration on each
395
+ control plane host.
396
+
397
+ # ## Verify that newly written data is encrypted {#verifying-that-data-is-encrypted}
398
+
399
+ Data is encrypted when written to etcd. After restarting your `kube-apiserver`, any newly
400
+ created or updated Secret (or other resource kinds configured in `EncryptionConfiguration`)
401
+ should be encrypted when stored.
402
+
403
+ To check this, you can use the `etcdctl` command line
394
404
program to retrieve the contents of your secret data.
395
405
406
+ This example shows how to check this for encrypting the Secret API.
407
+
396
408
1. Create a new Secret called `secret1` in the `default` namespace :
397
409
398
410
` ` ` shell
399
411
kubectl create secret generic secret1 -n default --from-literal=mykey=mydata
400
412
` ` `
401
413
402
- 1. Using the `etcdctl` command line, read that Secret out of etcd :
414
+ 1. Using the `etcdctl` command line tool , read that Secret out of etcd :
403
415
404
416
` ` `
405
417
ETCDCTL_API=3 etcdctl get /registry/secrets/default/secret1 [...] | hexdump -C
@@ -444,23 +456,36 @@ program to retrieve the contents of your secret data.
444
456
kubectl get secret secret1 -n default -o yaml
445
457
```
446
458
447
- The output should contain ` mykey: bXlkYXRh ` , with contents of ` mydata ` encoded, check
459
+ The output should contain ` mykey: bXlkYXRh ` , with contents of ` mydata ` encoded using base64;
460
+ read
448
461
[ decoding a Secret] ( /docs/tasks/configmap-secret/managing-secret-using-kubectl/#decoding-secret )
449
- to completely decode the Secret.
462
+ to learn how to completely decode the Secret.
463
+
464
+ ### Ensure all relevant data are encrypted {#ensure-all-secrets-are-encrypted}
450
465
451
- ## Ensure all Secrets are encrypted
466
+ It's often not enough to make sure that new objects get encrypted: you also want that
467
+ encryption to apply to the objects that are already stored.
452
468
453
- Since Secrets are encrypted on write, performing an update on a Secret will encrypt that content.
469
+ For this example, you have configured your cluster so that Secrets are encrypted on write.
470
+ Performing a replace operation for each Secret will encrypt that content at rest,
471
+ where the objects are unchanged.
472
+
473
+ You can make this change across all Secrets in your cluster:
454
474
455
475
``` shell
476
+ # Run this as an administrator that can read and write all Secrets
456
477
kubectl get secrets --all-namespaces -o json | kubectl replace -f -
457
478
```
458
479
459
- The command above reads all Secrets and then updates them to apply server side encryption.
480
+ The command above reads all Secrets and then updates them with the same data, in order to
481
+ apply server side encryption.
460
482
461
483
{{< note >}}
462
484
If an error occurs due to a conflicting write, retry the command.
463
- For larger clusters, you may wish to subdivide the secrets by namespace or script an update.
485
+ It is safe to run that command more than once.
486
+
487
+ For larger clusters, you may wish to subdivide the Secrets by namespace,
488
+ or script an update.
464
489
{{< /note >}}
465
490
466
491
## Rotating a decryption key
0 commit comments