|
| 1 | + |
| 2 | +# KEP-2907: Secrets Store CSI Provider |
| 3 | + |
| 4 | +<!-- toc --> |
| 5 | +- [Release Signoff Checklist](#release-signoff-checklist) |
| 6 | +- [Summary](#summary) |
| 7 | +- [Motivation](#motivation) |
| 8 | + - [Goals](#goals) |
| 9 | + - [Non-Goals](#non-goals) |
| 10 | +- [Proposal](#proposal) |
| 11 | + - [User Stories (Optional)](#user-stories-optional) |
| 12 | + - [Application reads secret from disk on startup](#application-reads-secret-from-disk-on-startup) |
| 13 | + - [Application watches secret for rotation](#application-watches-secret-for-rotation) |
| 14 | + - [Application Pod YAML remains unchanged and works across secret providers](#application-pod-yaml-remains-unchanged-and-works-across-secret-providers) |
| 15 | + - [Notes/Constraints/Caveats (Optional)](#notesconstraintscaveats-optional) |
| 16 | + - [Risks and Mitigations](#risks-and-mitigations) |
| 17 | + - [Directory traversal vulnerabilities](#directory-traversal-vulnerabilities) |
| 18 | + - [Authenticating to external secret APIs](#authenticating-to-external-secret-apis) |
| 19 | +- [Design Details](#design-details) |
| 20 | + - [Test Plan](#test-plan) |
| 21 | + - [Graduation Criteria](#graduation-criteria) |
| 22 | + - [GA](#ga) |
| 23 | + - [Deprecation](#deprecation) |
| 24 | +- [Production Readiness Review Questionnaire](#production-readiness-review-questionnaire) |
| 25 | + - [Feature Enablement and Rollback](#feature-enablement-and-rollback) |
| 26 | + - [Monitoring Requirements](#monitoring-requirements) |
| 27 | + - [Dependencies](#dependencies) |
| 28 | + - [Scalability](#scalability) |
| 29 | + - [Troubleshooting](#troubleshooting) |
| 30 | +- [Implementation History](#implementation-history) |
| 31 | +- [Drawbacks](#drawbacks) |
| 32 | +- [Alternatives](#alternatives) |
| 33 | +<!-- /toc --> |
| 34 | + |
| 35 | +## Release Signoff Checklist |
| 36 | + |
| 37 | +<!-- |
| 38 | +**ACTION REQUIRED:** In order to merge code into a release, there must be an |
| 39 | +issue in [kubernetes/enhancements] referencing this KEP and targeting a release |
| 40 | +milestone **before the [Enhancement Freeze](https://git.k8s.io/sig-release/releases) |
| 41 | +of the targeted release**. |
| 42 | +
|
| 43 | +For enhancements that make changes to code or processes/procedures in core |
| 44 | +Kubernetes—i.e., [kubernetes/kubernetes], we require the following Release |
| 45 | +Signoff checklist to be completed. |
| 46 | +
|
| 47 | +Check these off as they are completed for the Release Team to track. These |
| 48 | +checklist items _must_ be updated for the enhancement to be released. |
| 49 | +--> |
| 50 | + |
| 51 | +Items marked with (R) are required *prior to targeting to a milestone / release*. |
| 52 | + |
| 53 | +- [ ] (R) Enhancement issue in release milestone, which links to KEP dir in [kubernetes/enhancements] (not the initial KEP PR) |
| 54 | +- [ ] (R) KEP approvers have approved the KEP status as `implementable` |
| 55 | +- [ ] (R) Design details are appropriately documented |
| 56 | +- [ ] (R) Test plan is in place, giving consideration to SIG Architecture and SIG Testing input (including test refactors) |
| 57 | + - [ ] e2e Tests for all Beta API Operations (endpoints) |
| 58 | + - [ ] (R) Ensure GA e2e tests for meet requirements for [Conformance Tests](https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/conformance-tests.md) |
| 59 | + - [ ] (R) Minimum Two Week Window for GA e2e tests to prove flake free |
| 60 | +- [ ] (R) Graduation criteria is in place |
| 61 | + - [ ] (R) [all GA Endpoints](https://github.com/kubernetes/community/pull/1806) must be hit by [Conformance Tests](https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/conformance-tests.md) |
| 62 | +- [ ] (R) Production readiness review completed |
| 63 | +- [ ] (R) Production readiness review approved |
| 64 | +- [ ] "Implementation History" section is up-to-date for milestone |
| 65 | +- [ ] User-facing documentation has been created in [kubernetes/website], for publication to [kubernetes.io] |
| 66 | +- [ ] Supporting documentation—e.g., additional design documents, links to mailing list discussions/SIG meetings, relevant PRs/issues, release notes |
| 67 | + |
| 68 | +<!-- |
| 69 | +**Note:** This checklist is iterative and should be reviewed and updated every time this enhancement is being considered for a milestone. |
| 70 | +--> |
| 71 | + |
| 72 | +[kubernetes.io]: https://kubernetes.io/ |
| 73 | +[kubernetes/enhancements]: https://git.k8s.io/enhancements |
| 74 | +[kubernetes/kubernetes]: https://git.k8s.io/kubernetes |
| 75 | +[kubernetes/website]: https://git.k8s.io/website |
| 76 | + |
| 77 | +## Summary |
| 78 | + |
| 79 | +The [secrets-store-csi-driver](https://github.com/kubernetes-sigs/secrets-store-csi-driver) project provides a portable method for applications to consume secrets from external secret APIs through the filesystem. This effort was added to the `sig-auth` subproject in February 2020 and currently there are providers for Azure, AWS, GCP, and HashiCorp Vault. This KEP intends to cover making the core functionality of the driver GA. |
| 80 | + |
| 81 | +## Motivation |
| 82 | + |
| 83 | +<!-- |
| 84 | +This section is for explicitly listing the motivation, goals, and non-goals of |
| 85 | +this KEP. Describe why the change is important and the benefits to users. The |
| 86 | +motivation section can optionally provide links to [experience reports] to |
| 87 | +demonstrate the interest in a KEP within the wider Kubernetes community. |
| 88 | +
|
| 89 | +[experience reports]: https://github.com/golang/go/wiki/ExperienceReports |
| 90 | +--> |
| 91 | + |
| 92 | +### Goals |
| 93 | + |
| 94 | +- Signal the stability of the driver interface and implementation for the core task of making secrets available to pod filesystems. |
| 95 | + |
| 96 | +### Non-Goals |
| 97 | + |
| 98 | +- Extending the Kubernetes Secret object |
| 99 | +- Introduce a new Kubernetes type |
| 100 | + |
| 101 | +## Proposal |
| 102 | + |
| 103 | +This project introduces a new Container Storage Interface (CSI) driver for fetching secrets and writing to a `tmpfs` mount in the Pod filesystem. The driver is deployed as a `DaemonSet`. A new Custom Resource Definition (CRD) called a `SecretProviderClass` is introduced with informs the driver of which external secret storage API to contact and how to map the secrets from those APIs to file paths. The driver communicates with the extneral secret provider processes through a gRPC interface over a Unix Domain Socket. |
| 104 | + |
| 105 | +### User Stories (Optional) |
| 106 | + |
| 107 | +#### Application reads secret from disk on startup |
| 108 | + |
| 109 | +#### Application watches secret for rotation |
| 110 | + |
| 111 | +#### Application Pod YAML remains unchanged and works across secret providers |
| 112 | + |
| 113 | +### Notes/Constraints/Caveats (Optional) |
| 114 | + |
| 115 | +Since the proposal is a storage driver, native support for presenting secrets to a process through environment variables is not possible. |
| 116 | + |
| 117 | +### Risks and Mitigations |
| 118 | + |
| 119 | +#### Directory traversal vulnerabilities |
| 120 | + |
| 121 | +The driver<->provider interface has been expanded to allow the driver to be the only process that actually writes files to the pod filesystem. The only hostpath provider's need are now the one for creating the unix socket with the driver process. |
| 122 | + |
| 123 | +The driver protects against directory traversal vulnerabilities by re-using the `atomic_writer` used by Kubernetes Secrets and ConfigMaps which includes protections against writing to unintended paths. |
| 124 | + |
| 125 | +#### Authenticating to external secret APIs |
| 126 | + |
| 127 | +Authentication and authorization is largely up to the external API and its provider process, but the driver itself does include a few features that enable scoping access to secrets to individual pods. |
| 128 | + |
| 129 | +[Pod info](https://github.com/kubernetes/enhancements/tree/master/keps/sig-storage/603-csi-pod-info) is propagated to the external provider. |
| 130 | + |
| 131 | +Additionally [KEP 1855](https://github.com/kubernetes/enhancements/tree/master/keps/sig-storage/1855-csi-driver-service-account-token) allows the driver to propagate a token to the provider. This enabled the providers to impersonate the pod for fetching secrets without the need granting large RBAC scopes. |
| 132 | + |
| 133 | +## Design Details |
| 134 | + |
| 135 | +### Test Plan |
| 136 | + |
| 137 | +- Automated pre and post submit end-to-end integration tests |
| 138 | +- Periodic end-to-end integration tests |
| 139 | +- Supported providers each have their own integration test suites along with a reference provider |
| 140 | + |
| 141 | +### Graduation Criteria |
| 142 | + |
| 143 | +#### GA |
| 144 | + |
| 145 | +- Month+ soak of minor release |
| 146 | +- Completion of milestone requirements |
| 147 | +- Agreement of stability documented on community call from 3+ provider maintainers |
| 148 | + |
| 149 | +#### Deprecation |
| 150 | + |
| 151 | +- Announce deprecation and support policy of the existing flag |
| 152 | +- Two versions passed since introducing the functionality that deprecates the flag (to address version skew) |
| 153 | +- Address feedback on usage/changed behavior, provided on GitHub issues |
| 154 | +- Deprecate the flag |
| 155 | + |
| 156 | +## Production Readiness Review Questionnaire |
| 157 | + |
| 158 | +<!-- |
| 159 | +
|
| 160 | +Production readiness reviews are intended to ensure that features merging into |
| 161 | +Kubernetes are observable, scalable and supportable; can be safely operated in |
| 162 | +production environments, and can be disabled or rolled back in the event they |
| 163 | +cause increased failures in production. See more in the PRR KEP at |
| 164 | +https://git.k8s.io/enhancements/keps/sig-architecture/1194-prod-readiness. |
| 165 | +
|
| 166 | +The production readiness review questionnaire must be completed and approved |
| 167 | +for the KEP to move to `implementable` status and be included in the release. |
| 168 | +
|
| 169 | +In some cases, the questions below should also have answers in `kep.yaml`. This |
| 170 | +is to enable automation to verify the presence of the review, and to reduce review |
| 171 | +burden and latency. |
| 172 | +
|
| 173 | +The KEP must have a approver from the |
| 174 | +[`prod-readiness-approvers`](http://git.k8s.io/enhancements/OWNERS_ALIASES) |
| 175 | +team. Please reach out on the |
| 176 | +[#prod-readiness](https://kubernetes.slack.com/archives/CPNHUMN74) channel if |
| 177 | +you need any help or guidance. |
| 178 | +--> |
| 179 | + |
| 180 | +### Feature Enablement and Rollback |
| 181 | + |
| 182 | +This will be deployed to clusters as a standalone separate component. |
| 183 | + |
| 184 | +### Monitoring Requirements |
| 185 | + |
| 186 | +###### How can an operator determine if the feature is in use by workloads? |
| 187 | + |
| 188 | +<!-- |
| 189 | +Ideally, this should be a metric. Operations against the Kubernetes API (e.g., |
| 190 | +checking if there are objects with field X set) may be a last resort. Avoid |
| 191 | +logs or events for this purpose. |
| 192 | +--> |
| 193 | + |
| 194 | +###### How can someone using this feature know that it is working for their instance? |
| 195 | + |
| 196 | +<!-- |
| 197 | +For instance, if this is a pod-related feature, it should be possible to determine if the feature is functioning properly |
| 198 | +for each individual pod. |
| 199 | +Pick one more of these and delete the rest. |
| 200 | +Please describe all items visible to end users below with sufficient detail so that they can verify correct enablement |
| 201 | +and operation of this feature. |
| 202 | +Recall that end users cannot usually observe component logs or access metrics. |
| 203 | +--> |
| 204 | + |
| 205 | +- [ ] Events |
| 206 | + - Event Reason: |
| 207 | +- [ ] API .status |
| 208 | + - Condition name: |
| 209 | + - Other field: |
| 210 | +- [ ] Other (treat as last resort) |
| 211 | + - Details: |
| 212 | + |
| 213 | +###### What are the reasonable SLOs (Service Level Objectives) for the enhancement? |
| 214 | + |
| 215 | +<!-- |
| 216 | +This is your opportunity to define what "normal" quality of service looks like |
| 217 | +for a feature. |
| 218 | +
|
| 219 | +It's impossible to provide comprehensive guidance, but at the very |
| 220 | +high level (needs more precise definitions) those may be things like: |
| 221 | + - per-day percentage of API calls finishing with 5XX errors <= 1% |
| 222 | + - 99% percentile over day of absolute value from (job creation time minus expected |
| 223 | + job creation time) for cron job <= 10% |
| 224 | + - 99.9% of /health requests per day finish with 200 code |
| 225 | +
|
| 226 | +These goals will help you determine what you need to measure (SLIs) in the next |
| 227 | +question. |
| 228 | +--> |
| 229 | + |
| 230 | +###### What are the SLIs (Service Level Indicators) an operator can use to determine the health of the service? |
| 231 | + |
| 232 | +<!-- |
| 233 | +Pick one more of these and delete the rest. |
| 234 | +--> |
| 235 | + |
| 236 | +- [ ] Metrics |
| 237 | + - Metric name: |
| 238 | + - [Optional] Aggregation method: |
| 239 | + - Components exposing the metric: |
| 240 | +- [ ] Other (treat as last resort) |
| 241 | + - Details: |
| 242 | + |
| 243 | +###### Are there any missing metrics that would be useful to have to improve observability of this feature? |
| 244 | + |
| 245 | +<!-- |
| 246 | +Describe the metrics themselves and the reasons why they weren't added (e.g., cost, |
| 247 | +implementation difficulties, etc.). |
| 248 | +--> |
| 249 | + |
| 250 | +### Dependencies |
| 251 | + |
| 252 | +- [Kubernetes Container Storage Interface](https://github.com/kubernetes/community/blob/98b3d97d2e7f91bb62b8e88710c29c1675efb689/contributors/design-proposals/storage/container-storage-interface.md) |
| 253 | +- [KEP 596](https://github.com/kubernetes/enhancements/tree/master/keps/sig-storage/596-csi-inline-volumes) |
| 254 | +- Supports windows containers (Kubernetes version v1.18+) |
| 255 | +- [KEP 1855: Service Account Token for CSI Driver](https://github.com/kubernetes/enhancements/tree/master/keps/sig-storage/1855-csi-driver-service-account-token) |
| 256 | + |
| 257 | +###### Does this feature depend on any specific services running in the cluster? |
| 258 | + |
| 259 | +<!-- |
| 260 | +Think about both cluster-level services (e.g. metrics-server) as well |
| 261 | +as node-level agents (e.g. specific version of CRI). Focus on external or |
| 262 | +optional services that are needed. For example, if this feature depends on |
| 263 | +a cloud provider API, or upon an external software-defined storage or network |
| 264 | +control plane. |
| 265 | +
|
| 266 | +For each of these, fill in the following—thinking about running existing user workloads |
| 267 | +and creating new ones, as well as about cluster-level services (e.g. DNS): |
| 268 | + - [Dependency name] |
| 269 | + - Usage description: |
| 270 | + - Impact of its outage on the feature: |
| 271 | + - Impact of its degraded performance or high-error rates on the feature: |
| 272 | +--> |
| 273 | + |
| 274 | +### Scalability |
| 275 | + |
| 276 | +<!-- |
| 277 | +For alpha, this section is encouraged: reviewers should consider these questions |
| 278 | +and attempt to answer them. |
| 279 | +
|
| 280 | +For beta, this section is required: reviewers must answer these questions. |
| 281 | +
|
| 282 | +For GA, this section is required: approvers should be able to confirm the |
| 283 | +previous answers based on experience in the field. |
| 284 | +--> |
| 285 | + |
| 286 | +###### Will enabling / using this feature result in any new API calls? |
| 287 | + |
| 288 | +<!-- |
| 289 | +Describe them, providing: |
| 290 | + - API call type (e.g. PATCH pods) |
| 291 | + - estimated throughput |
| 292 | + - originating component(s) (e.g. Kubelet, Feature-X-controller) |
| 293 | +Focusing mostly on: |
| 294 | + - components listing and/or watching resources they didn't before |
| 295 | + - API calls that may be triggered by changes of some Kubernetes resources |
| 296 | + (e.g. update of object X triggers new updates of object Y) |
| 297 | + - periodic API calls to reconcile state (e.g. periodic fetching state, |
| 298 | + heartbeats, leader election, etc.) |
| 299 | +--> |
| 300 | + |
| 301 | +###### Will enabling / using this feature result in introducing new API types? |
| 302 | + |
| 303 | +<!-- |
| 304 | +Describe them, providing: |
| 305 | + - API type |
| 306 | + - Supported number of objects per cluster |
| 307 | + - Supported number of objects per namespace (for namespace-scoped objects) |
| 308 | +--> |
| 309 | + |
| 310 | +###### Will enabling / using this feature result in any new calls to the cloud provider? |
| 311 | + |
| 312 | +<!-- |
| 313 | +Describe them, providing: |
| 314 | + - Which API(s): |
| 315 | + - Estimated increase: |
| 316 | +--> |
| 317 | + |
| 318 | +###### Will enabling / using this feature result in increasing size or count of the existing API objects? |
| 319 | + |
| 320 | +<!-- |
| 321 | +Describe them, providing: |
| 322 | + - API type(s): |
| 323 | + - Estimated increase in size: (e.g., new annotation of size 32B) |
| 324 | + - Estimated amount of new objects: (e.g., new Object X for every existing Pod) |
| 325 | +--> |
| 326 | + |
| 327 | +###### Will enabling / using this feature result in increasing time taken by any operations covered by existing SLIs/SLOs? |
| 328 | + |
| 329 | +<!-- |
| 330 | +Look at the [existing SLIs/SLOs]. |
| 331 | +
|
| 332 | +Think about adding additional work or introducing new steps in between |
| 333 | +(e.g. need to do X to start a container), etc. Please describe the details. |
| 334 | +
|
| 335 | +[existing SLIs/SLOs]: https://git.k8s.io/community/sig-scalability/slos/slos.md#kubernetes-slisslos |
| 336 | +--> |
| 337 | + |
| 338 | +###### Will enabling / using this feature result in non-negligible increase of resource usage (CPU, RAM, disk, IO, ...) in any components? |
| 339 | + |
| 340 | +<!-- |
| 341 | +Things to keep in mind include: additional in-memory state, additional |
| 342 | +non-trivial computations, excessive access to disks (including increased log |
| 343 | +volume), significant amount of data sent and/or received over network, etc. |
| 344 | +This through this both in small and large cases, again with respect to the |
| 345 | +[supported limits]. |
| 346 | +
|
| 347 | +[supported limits]: https://git.k8s.io/community//sig-scalability/configs-and-limits/thresholds.md |
| 348 | +--> |
| 349 | + |
| 350 | +### Troubleshooting |
| 351 | + |
| 352 | +https://secrets-store-csi-driver.sigs.k8s.io/troubleshooting.html |
| 353 | + |
| 354 | +## Implementation History |
| 355 | + |
| 356 | +- Dec 2018 - [First Commit](https://github.com/kubernetes-sigs/secrets-store-csi-driver/commit/56fb54bfdb2058ef043ff36363b90787a52c51b7#diff-bc37d034bad564583790a46f19d807abfe519c5671395fd494d8cce506c42947) |
| 357 | +- Feb 2020 - [Incorporated into sig-auth with pluggable provider model](https://github.com/kubernetes/org/issues/1245) |
| 358 | +- May 2020 - [v0.0.10](https://github.com/kubernetes-sigs/secrets-store-csi-driver/releases/tag/v0.0.10) (First release) |
| 359 | +- July 2021 - [v0.1.0](https://github.com/kubernetes-sigs/secrets-store-csi-driver/releases/tag/v0.1.0) (First minor release) |
| 360 | + |
| 361 | +## Drawbacks |
| 362 | + |
| 363 | +- Environment Variables: There appears to be a strong desire to consume secrets using environment variables but the only way for this to work currently is through syncing secrets to Kubernetes Secrets. |
| 364 | +- Consume only: The proposed CRD and implementation does not provide a way to add/write/edit secrets in the external stores. |
| 365 | + |
| 366 | +## Alternatives |
| 367 | + |
| 368 | +<!-- |
| 369 | +What other approaches did you consider, and why did you rule them out? These do |
| 370 | +not need to be as detailed as the proposal, but should include enough |
| 371 | +information to express the idea and why it was not acceptable. |
| 372 | +--> |
0 commit comments