Skip to content

Commit 4fad75a

Browse files
author
Xander Grzywinski
committed
add blog post content
1 parent 2fd484a commit 4fad75a

File tree

1 file changed

+89
-0
lines changed

1 file changed

+89
-0
lines changed
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
# Kubernetes 1.25: KMS v2 Improvements
2+
3+
**Authors:** Anish Ramasekar, Rita Zhang, Mo Khan, and Xander Grzywinski (Microsoft)
4+
5+
With Kubernetes 1.25, we are introducing a new `v2alpha1` version of the Key Management Service (KMS) API. There are a lot of improvements in the works, and we're excited to be able to launch the alpha version with Kubernetes 1.25!
6+
7+
## What is KMS?
8+
One of the first things to consider when securing a Kubernetes cluster is encrypting etcd data at rest. KMS provides an interface for a provider to utilize a key stored in an external key service to perform this encryption.
9+
10+
KMS v1 has been a feature of Kubernetes since version 1.10, and is currently in beta as of version 1.12.
11+
12+
## What’s new in `v2alpha1`?
13+
While the original v1 implementation has been successful in helping Kubernetes users encrypt etcd data, it did fall short in a few key ways:
14+
15+
1. **Performance:** When starting a cluster, all resources are serially fetched and decrypted to fill the `kube-apiserver` cache. When using a KMS plugin, this can cause slow startup times due to the large number of requests made to the remote vault. In addition, there is the potential to hit API rate limits on external key services depending on how many encrypted resources exist in the cluster.
16+
1. **Rotation:** Currently, rotation of a KMS key is a manual and error-prone process. It can be difficult to determine what encryption keys are in-use on a cluster.
17+
1. **Health Check & Status:** Today the `kube-apiserver` uses encrypt and decrypt calls as a proxy to determine if the KMS plugin is healthy. These operations cost money with cloud services, and do not provide a holistic view of the service's health.
18+
1. **Observability:** Without some kind of trace ID, it's currently difficult to correlate events found in the various logs across `kube-apiserver`, KMS, and KMS plugins.
19+
20+
The KMS v2 enhancement attempts to address all of these shortcomings (not all planned features are implemented in the initial alpha release in Kubernetes 1.25):
21+
22+
1. Support KMS plugins that use a key hierarchy to reduce network requests made to the remote vault. To learn more, check out the [details for how a KMS plugin can leverage key hierarchy](https://github.com/kubernetes/enhancements/tree/master/keps/sig-auth/3299-kms-v2-improvements#key-hierachy).
23+
1. Extra metadata is now tracked to allow a KMS plugin to communicate what key it is currently using with the `kube-apiserver`, allowing for rotation without API server restart. Data stored in etcd follows a more standard proto format to allow external tools to observe its state. To learn more, check out the [details for metadata](https://github.com/kubernetes/enhancements/tree/master/keps/sig-auth/3299-kms-v2-improvements#metadata).
24+
1. A dedicated status API is used to communicate the health of the KMS plugin with the API server. To learn more, check out the [details for status API](https://github.com/kubernetes/enhancements/tree/master/keps/sig-auth/3299-kms-v2-improvements#status-api).
25+
26+
### Sequence Diagram
27+
28+
#### Encrypt Request
29+
30+
```mermaid
31+
sequenceDiagram
32+
participant etcd
33+
participant kubeapiserver
34+
participant kmsplugin
35+
participant externalkms
36+
kubeapiserver->>kmsplugin: encrypt request
37+
alt using key hierarchy
38+
kmsplugin->>kmsplugin: encrypt DEK with local KEK
39+
kmsplugin->>externalkms: encrypt local KEK with remote KEK
40+
externalkms->>kmsplugin: encrypted local KEK
41+
kmsplugin->>kmsplugin: cache encrypted local KEK
42+
kmsplugin->>kubeapiserver: return encrypt response <br/> {"ciphertext": "<encrypted DEK>", key_id: "<remote KEK ID>", <br/> "annotations": {"kms.kubernetes.io/local-kek": "<encrypted local KEK>"}}
43+
else not using key hierarchy
44+
%% current behavior
45+
kmsplugin->>externalkms: encrypt DEK with remote KEK
46+
externalkms->>kmsplugin: encrypted DEK
47+
kmsplugin->>kubeapiserver: return encrypt response <br/> {"ciphertext": "<encrypted DEK>", key_id: "<remote KEK ID>", "annotations": {}}
48+
end
49+
kubeapiserver->>etcd: store encrypt response and encrypted DEK
50+
```
51+
#### Decrypt Request
52+
53+
```mermaid
54+
sequenceDiagram
55+
participant kubeapiserver
56+
participant kmsplugin
57+
participant externalkms
58+
%% if local KEK in annotations, then using hierarchy
59+
alt encrypted local KEK is in annotations
60+
kubeapiserver->>kmsplugin: decrypt request <br/> {"ciphertext": "<encrypted DEK>", key_id: "<key_id gotten as part of EncryptResponse>", <br/> "annotations": {"kms.kubernetes.io/local-kek": "<encrypted local KEK>"}}
61+
alt encrypted local KEK in cache
62+
kmsplugin->>kmsplugin: decrypt DEK with local KEK
63+
else encrypted local KEK not in cache
64+
kmsplugin->>externalkms: decrypt local KEK with remote KEK
65+
externalkms->>kmsplugin: decrypted local KEK
66+
kmsplugin->>kmsplugin: decrypt DEK with local KEK
67+
kmsplugin->>kmsplugin: cache decrypted local KEK
68+
end
69+
kmsplugin->>kubeapiserver: return decrypt response <br/> {"plaintext": "<decrypted DEK>", key_id: "<remote KEK ID>", <br/> "annotations": {"kms.kubernetes.io/local-kek": "<encrypted local KEK>"}}
70+
else encrypted local KEK is not in annotations
71+
kubeapiserver->>kmsplugin: decrypt request <br/> {"ciphertext": "<encrypted DEK>", key_id: "<key_id gotten as part of EncryptResponse>", <br/> "annotations": {}}
72+
kmsplugin->>externalkms: decrypt DEK with remote KEK (same behavior as today)
73+
externalkms->>kmsplugin: decrypted DEK
74+
kmsplugin->>kubeapiserver: return decrypt response <br/> {"plaintext": "<decrypted DEK>", key_id: "<remote KEK ID>", <br/> "annotations": {}}
75+
end
76+
```
77+
78+
## What’s next?
79+
For Kubernetes 1.26, we plan to ship another alpha version. As of right now, the alpha API will be ready to be used by KMS plugin authors. We plan to include a reference plugin implementation with the next release, and you'll be able to try out the feature at that time.
80+
81+
You can learn more about KMS v2 by reading the [kubernetes documentation](https://kubernetes.io/docs/tasks/administer-cluster/kms-provider/). You can also follow along on the [KEP](https://github.com/kubernetes/enhancements/blob/master/keps/sig-auth/3299-kms-v2-improvements/README.md) to track progress across the coming Kubernetes releases.
82+
83+
## How to get involved
84+
If you are interested in getting involved in the development of this feature, share feedback, or participate in any other ongoing SIG Auth projects, please reach out on the [#sig-auth](https://kubernetes.slack.com/archives/C0EN96KUY) channel on Kubernetes Slack.
85+
86+
You are also welcome to join the bi-weekly [SIG Auth meetings](https://github.com/kubernetes/community/blob/master/sig-auth/README.md#meetings), held every-other Wednesday.
87+
88+
## Acknowledgements
89+
This feature has been an effort driven by contributors from several different companies. We would like to extend a huge thank you to everyone that contributed their time and effort to help make this possible.

0 commit comments

Comments
 (0)