You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The KMS encryption provider uses an envelope encryption scheme to encrypt data in etcd. The data is encrypted using a data encryption key (DEK); a new DEK is generated for each encryption. The DEKs are encrypted with a key encryption key (KEK) that is stored and managed in a remote KMS. The KMS provider uses gRPC to communicate with a specific KMS
@@ -30,10 +26,12 @@ plugin. The KMS plugin, which is implemented as a gRPC server and deployed on th
30
26
31
27
To configure a KMS provider on the API server, include a provider of type ```kms``` in the providers array in the encryption configuration file and set the following properties:
32
28
33
-
*`name`: Display name of the KMS plugin.
34
-
*`endpoint`: Listen address of the gRPC server (KMS plugin). The endpoint is a UNIX domain socket.
35
-
*`cachesize`: Number of data encryption keys (DEKs) to be cached in the clear. When cached, DEKs can be used without another call to the KMS; whereas DEKs that are not cached require a call to the KMS to unwrap.
36
-
*`timeout`: How long should kube-apiserver wait for kms-plugin to respond before returning an error (default is 3 seconds).
29
+
*`name`: Display name of the KMS plugin.
30
+
*`endpoint`: Listen address of the gRPC server (KMS plugin). The endpoint is a UNIX domain socket.
31
+
*`cachesize`: Number of data encryption keys (DEKs) to be cached in the clear.
32
+
When cached, DEKs can be used without another call to the KMS;
33
+
whereas DEKs that are not cached require a call to the KMS to unwrap.
34
+
*`timeout`: How long should kube-apiserver wait for kms-plugin to respond before returning an error (default is 3 seconds).
37
35
38
36
See [Understanding the encryption at rest configuration.](/docs/tasks/administer-cluster/encrypt-data)
39
37
@@ -57,17 +55,18 @@ Then use the functions and data structures in the stub file to develop the serve
57
55
58
56
* kms plugin version: `v1beta1`
59
57
60
-
In response to procedure call Version, a compatible KMS plugin should return v1beta1 as VersionResponse.version
58
+
In response to procedure call Version, a compatible KMS plugin should return v1beta1 as VersionResponse.version.
61
59
62
60
* message version: `v1beta1`
63
61
64
-
All messages from KMS provider have the version field set to current version v1beta1
62
+
All messages from KMS provider have the version field set to current version v1beta1.
65
63
66
64
* protocol: UNIX domain socket (`unix`)
67
65
68
-
The gRPC server should listen at UNIX domain socket
66
+
The gRPC server should listen at UNIX domain socket.
69
67
70
68
### Integrating a KMS plugin with the remote KMS
69
+
71
70
The KMS plugin can communicate with the remote KMS using any protocol supported by the KMS.
72
71
All configuration data, including authentication credentials the KMS plugin uses to communicate with the remote KMS,
73
72
are stored and managed by the KMS plugin independently. The KMS plugin can encode the ciphertext with additional metadata that may be required before sending it to the KMS for decryption.
@@ -80,108 +79,113 @@ To encrypt the data:
80
79
81
80
1. Create a new encryption configuration file using the appropriate properties for the `kms` provider:
82
81
83
-
```yaml
84
-
apiVersion: apiserver.config.k8s.io/v1
85
-
kind: EncryptionConfiguration
86
-
resources:
87
-
- resources:
88
-
- secrets
89
-
providers:
90
-
- kms:
91
-
name: myKmsPlugin
92
-
endpoint: unix:///tmp/socketfile.sock
93
-
cachesize: 100
94
-
timeout: 3s
95
-
- identity: {}
96
-
```
97
-
98
-
2. Set the `--encryption-provider-config` flag on the kube-apiserver to point to the location of the configuration file.
99
-
3. Restart your API server.
100
-
101
-
Note:
102
-
The alpha version of the encryption feature prior to 1.13 required a config file with
103
-
`kind: EncryptionConfig` and `apiVersion: v1`, and used the `--experimental-encryption-provider-config` flag.
82
+
```yaml
83
+
apiVersion: apiserver.config.k8s.io/v1
84
+
kind: EncryptionConfiguration
85
+
resources:
86
+
- resources:
87
+
- secrets
88
+
providers:
89
+
- kms:
90
+
name: myKmsPlugin
91
+
endpoint: unix:///tmp/socketfile.sock
92
+
cachesize: 100
93
+
timeout: 3s
94
+
- identity: {}
95
+
```
96
+
97
+
1. Set the `--encryption-provider-config` flag on the kube-apiserver to point to the location of the configuration file.
98
+
1. Restart your API server.
104
99
105
100
## Verifying that the data is encrypted
106
-
Data is encrypted when written to etcd. After restarting your kube-apiserver, any newly created or updated secret should be encrypted when stored. To verify, you can use the etcdctl command line program to retrieve the contents of your secret.
107
-
108
-
1. Create a new secret called secret1 in the default namespace:
1. Using the etcdctl command line, read that secret out of etcd:
111
+
```
112
+
ETCDCTL_API=3 etcdctl get /kubernetes.io/secrets/default/secret1 [...] | hexdump -C
113
+
```
114
+
where `[...]` must be the additional arguments for connecting to the etcd server.
115
+
116
+
1. Verify the stored secret is prefixed with `k8s:enc:kms:v1:`, which indicates that the `kms` provider has encrypted the resulting data.
117
+
118
+
1. Verify that the secret is correctly decrypted when retrieved via the API:
119
+
```
120
+
kubectl describe secret secret1 -n default
121
+
```
122
+
should match `mykey: mydata`
125
123
126
124
## Ensuring all secrets are encrypted
125
+
127
126
Because secrets are encrypted on write, performing an update on a secret encrypts that content.
128
127
129
-
The following command reads all secrets and then updates them to apply server side encryption. If an error occurs due to a conflicting write, retry the command. For larger clusters, you may wish to subdivide the secrets by namespace or script an update.
128
+
The following command reads all secrets and then updates them to apply server side encryption.
129
+
If an error occurs due to a conflicting write, retry the command.
130
+
For larger clusters, you may wish to subdivide the secrets by namespace or script an update.
0 commit comments