Skip to content

Commit 5b6f1a1

Browse files
authored
Merge pull request #33563 from tengqm/kms-link
Update KMS provider page
2 parents 66dff89 + 614fcc0 commit 5b6f1a1

File tree

1 file changed

+58
-26
lines changed

1 file changed

+58
-26
lines changed

content/en/docs/tasks/administer-cluster/kms-provider.md

Lines changed: 58 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -19,43 +19,58 @@ This page shows how to configure a Key Management Service (KMS) provider and plu
1919

2020
<!-- steps -->
2121

22-
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
23-
plugin. The KMS plugin, which is implemented as a gRPC server and deployed on the same host(s) as the Kubernetes master(s), is responsible for all communication with the remote KMS.
22+
The KMS encryption provider uses an envelope encryption scheme to encrypt data in etcd.
23+
The data is encrypted using a data encryption key (DEK); a new DEK is generated for each encryption.
24+
The DEKs are encrypted with a key encryption key (KEK) that is stored and managed in a remote KMS.
25+
The KMS provider uses gRPC to communicate with a specific KMS plugin.
26+
The KMS plugin, which is implemented as a gRPC server and deployed on the same host(s)
27+
as the Kubernetes control plane, is responsible for all communication with the remote KMS.
2428

2529
## Configuring the KMS provider
2630

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:
31+
To configure a KMS provider on the API server, include a provider of type `kms` in the
32+
`providers` array in the encryption configuration file and set the following properties:
2833

2934
* `name`: Display name of the KMS plugin.
3035
* `endpoint`: Listen address of the gRPC server (KMS plugin). The endpoint is a UNIX domain socket.
3136
* `cachesize`: Number of data encryption keys (DEKs) to be cached in the clear.
3237
When cached, DEKs can be used without another call to the KMS;
3338
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).
39+
* `timeout`: How long should `kube-apiserver` wait for kms-plugin to respond before
40+
returning an error (default is 3 seconds).
3541

36-
See [Understanding the encryption at rest configuration.](/docs/tasks/administer-cluster/encrypt-data)
42+
See [Understanding the encryption at rest configuration](/docs/tasks/administer-cluster/encrypt-data).
3743

3844
## Implementing a KMS plugin
3945

40-
To implement a KMS plugin, you can develop a new plugin gRPC server or enable a KMS plugin already provided by your cloud provider. You then integrate the plugin with the remote KMS and deploy it on the Kubernetes master.
46+
To implement a KMS plugin, you can develop a new plugin gRPC server or enable a KMS plugin
47+
already provided by your cloud provider.
48+
You then integrate the plugin with the remote KMS and deploy it on the Kubernetes master.
4149

4250
### Enabling the KMS supported by your cloud provider
51+
4352
Refer to your cloud provider for instructions on enabling the cloud provider-specific KMS plugin.
4453

4554
### Developing a KMS plugin gRPC server
46-
You can develop a KMS plugin gRPC server using a stub file available for Go. For other languages, you use a proto file to create a stub file that you can use to develop the gRPC server code.
4755

48-
* Using Go: Use the functions and data structures in the stub file: [service.pb.go](https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/apiserver/pkg/storage/value/encrypt/envelope/v1beta1/service.pb.go) to develop the gRPC server code
56+
You can develop a KMS plugin gRPC server using a stub file available for Go. For other languages,
57+
you use a proto file to create a stub file that you can use to develop the gRPC server code.
58+
59+
* Using Go: Use the functions and data structures in the stub file:
60+
[service.pb.go](https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/apiserver/pkg/storage/value/encrypt/envelope/v1beta1/service.pb.go)
61+
to develop the gRPC server code
4962

50-
* Using languages other than Go: Use the protoc compiler with the proto file: [service.proto](https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/apiserver/pkg/storage/value/encrypt/envelope/v1beta1/service.proto) to generate a stub file for the specific language
63+
* Using languages other than Go: Use the protoc compiler with the proto file:
64+
[service.proto](https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/apiserver/pkg/storage/value/encrypt/envelope/v1beta1/service.proto)
65+
to generate a stub file for the specific language
5166

5267
Then use the functions and data structures in the stub file to develop the server code.
5368

5469
**Notes:**
5570

5671
* kms plugin version: `v1beta1`
5772

58-
In response to procedure call Version, a compatible KMS plugin should return v1beta1 as VersionResponse.version.
73+
In response to procedure call Version, a compatible KMS plugin should return `v1beta1` as `VersionResponse.version`.
5974

6075
* message version: `v1beta1`
6176

@@ -69,12 +84,15 @@ Then use the functions and data structures in the stub file to develop the serve
6984

7085
The KMS plugin can communicate with the remote KMS using any protocol supported by the KMS.
7186
All configuration data, including authentication credentials the KMS plugin uses to communicate with the remote KMS,
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.
87+
are stored and managed by the KMS plugin independently.
88+
The KMS plugin can encode the ciphertext with additional metadata that may be required before sending it to the KMS for decryption.
7389

7490
### Deploying the KMS plugin
91+
7592
Ensure that the KMS plugin runs on the same host(s) as the Kubernetes master(s).
7693

7794
## Encrypting your data with the KMS provider
95+
7896
To encrypt the data:
7997

8098
1. Create a new encryption configuration file using the appropriate properties for the `kms` provider:
@@ -94,32 +112,43 @@ To encrypt the data:
94112
- identity: {}
95113
```
96114
97-
1. Set the `--encryption-provider-config` flag on the kube-apiserver to point to the location of the configuration file.
115+
1. Set the `--encryption-provider-config` flag on the kube-apiserver to point to
116+
the location of the configuration file.
98117
1. Restart your API server.
99118

119+
For details about the `EncryptionConfiguration` format, please check the
120+
[API server encryption API reference](/docs/reference/config-api/apiserver-encryption.v1/).
121+
100122
## Verifying that the data is encrypted
101123

102124
Data is encrypted when written to etcd. After restarting your `kube-apiserver`,
103125
any newly created or updated secret should be encrypted when stored. To verify,
104126
you can use the `etcdctl` command line program to retrieve the contents of your secret.
105127

106-
1. Create a new secret called secret1 in the default namespace:
107-
```
128+
1. Create a new secret called `secret1` in the `default` namespace:
129+
130+
```shell
108131
kubectl create secret generic secret1 -n default --from-literal=mykey=mydata
109132
```
110-
1. Using the etcdctl command line, read that secret out of etcd:
111-
```
133+
134+
1. Using the `etcdctl` command line, read that secret out of etcd:
135+
136+
```shell
112137
ETCDCTL_API=3 etcdctl get /kubernetes.io/secrets/default/secret1 [...] | hexdump -C
113138
```
114-
where `[...]` must be the additional arguments for connecting to the etcd server.
115139

116-
1. Verify the stored secret is prefixed with `k8s:enc:kms:v1:`, which indicates that the `kms` provider has encrypted the resulting data.
140+
where `[...]` contains the additional arguments for connecting to the etcd server.
141+
142+
1. Verify the stored secret is prefixed with `k8s:enc:kms:v1:`, which indicates that
143+
the `kms` provider has encrypted the resulting data.
117144

118145
1. Verify that the secret is correctly decrypted when retrieved via the API:
119-
```
146+
147+
```shell
120148
kubectl describe secret secret1 -n default
121149
```
122-
should match `mykey: mydata`
150+
151+
The Secret should contain `mykey: mydata`
123152

124153
## Ensuring all secrets are encrypted
125154

@@ -129,7 +158,7 @@ The following command reads all secrets and then updates them to apply server si
129158
If an error occurs due to a conflicting write, retry the command.
130159
For larger clusters, you may wish to subdivide the secrets by namespace or script an update.
131160

132-
```
161+
```shell
133162
kubectl get secrets --all-namespaces -o json | kubectl replace -f -
134163
```
135164

@@ -156,12 +185,12 @@ To switch from a local encryption provider to the `kms` provider and re-encrypt
156185
secret: <BASE 64 ENCODED SECRET>
157186
```
158187

159-
1. Restart all kube-apiserver processes.
188+
1. Restart all `kube-apiserver` processes.
160189

161190
1. Run the following command to force all secrets to be re-encrypted using the `kms` provider.
162191

163-
```
164-
kubectl get secrets --all-namespaces -o json| kubectl replace -f -
192+
```shell
193+
kubectl get secrets --all-namespaces -o json | kubectl replace -f -
165194
```
166195

167196
## Disabling encryption at rest
@@ -183,9 +212,12 @@ To disable encryption at rest:
183212
endpoint: unix:///tmp/socketfile.sock
184213
cachesize: 100
185214
```
186-
1. Restart all kube-apiserver processes.
215+
216+
1. Restart all `kube-apiserver` processes.
217+
187218
1. Run the following command to force all secrets to be decrypted.
188-
```
219+
220+
```shell
189221
kubectl get secrets --all-namespaces -o json | kubectl replace -f -
190222
```
191223

0 commit comments

Comments
 (0)