Skip to content

Latest commit

 

History

History
388 lines (283 loc) · 17.8 KB

File metadata and controls

388 lines (283 loc) · 17.8 KB

KEP-2907: Secrets Store CSI Provider

Release Signoff Checklist

Items marked with (R) are required prior to targeting to a milestone / release.

  • (R) Enhancement issue in release milestone, which links to KEP dir in kubernetes/enhancements (not the initial KEP PR)
  • (R) KEP approvers have approved the KEP status as implementable
  • (R) Design details are appropriately documented
  • (R) Test plan is in place, giving consideration to SIG Architecture and SIG Testing input (including test refactors)
    • e2e Tests for all Beta API Operations (endpoints)
    • (R) Ensure GA e2e tests for meet requirements for Conformance Tests
    • (R) Minimum Two Week Window for GA e2e tests to prove flake free
  • (R) Graduation criteria is in place
  • (R) Production readiness review completed
  • (R) Production readiness review approved
  • "Implementation History" section is up-to-date for milestone
  • User-facing documentation has been created in kubernetes/website, for publication to kubernetes.io
  • Supporting documentation—e.g., additional design documents, links to mailing list discussions/SIG meetings, relevant PRs/issues, release notes

Summary

The 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. All the providers for the driver are out-of-tree. This KEP intends to cover making the core functionality of the driver GA.

Motivation

Goals

  • Signal the stability of the driver interface and implementation for the core task of making secrets available to pod filesystem.

Non-Goals

  • Extending the Kubernetes Secret object
  • Introduce a new Kubernetes type
  • Consume only: The proposed CRD and implementation does not provide a way to add/write/edit secrets in the external stores.

Proposal

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 that 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 external secret provider processes through a gRPC interface over a Unix Domain Socket.

User Stories (Optional)

Story 1

  1. Application reads secret from filesystem on startup
  2. Application watches secret for rotation
  3. Application Pod YAML remains unchanged and works across secret providers

Notes/Constraints/Caveats (Optional)

Since the proposal is a storage driver, native support for presenting secrets to a process through environment variables is not possible. The driver includes a method to sync the mounted content as Kubernetes secret. This is an optional feature, isn't enabled by default, and will not be considered a GA feature of the driver.

Risks and Mitigations

Directory traversal vulnerabilities

CVE-2020-8567 is an example of this risk. Since then, the interface between the driver and provider processes has been updated to:

  • eliminate the kubelet/pods hostPath volume mount from providers
  • consolidate all filesystem IO to the driver process

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.

Providers need a single remaining hostPath to share a unix domain socket file with the driver process, but this path has no other system critical or security sensitive access.

Authenticating to external secret APIs

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.

Pod info is propagated to the external provider.

Additionally KEP 1855 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.

Design Details

Test Plan

  • Automated pre and post submit end-to-end integration tests
  • Periodic end-to-end integration tests
  • Supported providers each have their own integration test suites along with a reference provider

Graduation Criteria

GA

  • Month+ soak of minor release
  • Completion of milestone requirements
  • Agreement of stability documented on community call from 3+ provider maintainers
  • User facing API groups (SecretProviderClass and SecretProviderClassPodStatus CRDs) promoted to v1

Deprecation

There are currently no planned deprecations. The following rules will be followed if a deprecation is needed.

  • Announce deprecation and support policy of the existing flag
  • Two versions passed since introducing the functionality that deprecates the flag (to address version skew)
  • Address feedback on usage/changed behavior, provided on GitHub issues
  • Deprecate the flag

Production Readiness Review Questionnaire

Feature Enablement and Rollback

This will be deployed to clusters as a standalone separate component.

Monitoring Requirements

How can an operator determine if the feature is in use by workloads?
How can someone using this feature know that it is working for their instance?
  • non-zero total_node_publish metrics indicate the CSI driver is used by the workloads.
  • total_sync_k8s_secret metrics indicate the optional Sync as Kubernetes secret feature is used by the workloads.
  • total_rotation_reconcile metrics indicate the optional rotation reconciliation feature is used by the workloads.
What are the reasonable SLOs (Service Level Objectives) for the enhancement?
  • total_node_publish_error
    • any rising count of this metric indicates a problem with mounting the volume for pod.
  • total_node_unpublish_error
    • any rising count of this metric indicates a problem with unmounting the volume for pod.
What are the SLIs (Service Level Indicators) an operator can use to determine the health of the service?
  • Metrics
    • Metric name: total_node_publish
    • Components exposing the metric: secrets-store-csi-driver
  • Other
    • Details: The CSI driver is configured with liveness and readiness probes. The liveness check is performed using the liveness-probe sidecar container. The liveness probe sidecar container exposes an HTTP /healthz endpoint which serves as kubelet's livenessProbe hook to monitor health of the CSI driver. The liveness probe uses Probe() RPC call to check the CSI driver is healthy.
Are there any missing metrics that would be useful to have to improve observability of this feature?

Dependencies

The driver uses CSI Inline Volumes to mount the external secrets-store objects in the pod. The CSI Inline Volumes feature is enabled by default in Kubernetes 1.16+. For windows containers, the CSI Inline Volumes feature is enabled by default in Kubernetes 1.18+.

The minimum supported Kubernetes version is 1.16 for Linux and 1.18 for Windows.

Does this feature depend on any specific services running in the cluster?
  • Kubelet
    • If kubelet service is not running, the pods referencing the csi driver for volume will fail to start.

Scalability

Load test results: https://secrets-store-csi-driver.sigs.k8s.io/load-tests.html

Will enabling / using this feature result in any new API calls?
Will enabling / using this feature result in introducing new API types?
Will enabling / using this feature result in any new calls to the cloud provider?
Will enabling / using this feature result in increasing size or count of the existing API objects?
Will enabling / using this feature result in increasing time taken by any operations covered by existing SLIs/SLOs?
Will enabling / using this feature result in non-negligible increase of resource usage (CPU, RAM, disk, IO, ...) in any components?

Troubleshooting

https://secrets-store-csi-driver.sigs.k8s.io/troubleshooting.html

Implementation History

Drawbacks

  • 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.

Alternatives