⎈ k8s knowledge compiler

Encrypting Confidential Data at Rest [page]deterministic

tasks

All of the APIs in Kubernetes that let you write persistent API resource data support at-rest encryption. For example, you can enable at-rest encryption for [Secrets](#gloss:secret). This at-rest encryption is additional to any system-level encryption for the etcd cluster or for the filesystem(s) on hosts where you are running the kube-apiserver.

This page shows how to enable and configure encryption of API data at rest.

> Note: This task covers encryption for resource data stored using the . For example, you can encrypt Secret objects, including the key-value data they contain.

If you want to encrypt data in filesystems that are mounted into containers, you instead need to either:

  • use a storage integration that provides encrypted
  • encrypt the data within your own application

##

*

* This task assumes that you are running the Kubernetes API server as a [static pod](#gloss:static-pod) on each control plane node.

* Your cluster's control plane must use etcd v3.x (major version 3, any minor version).

* To encrypt a custom resource, your cluster must be running Kubernetes v1.26 or newer.

* To use a wildcard to match resources, your cluster must be running Kubernetes v1.27 or newer.

## Determine whether encryption at rest is already enabled {#determining-whether-encryption-at-rest-is-already-enabled}

By default, the API server stores plain-text representations of resources into etcd, with no at-rest encryption.

The `kube-apiserver` process accepts an argument `--encryption-provider-config` that specifies a path to a configuration file. The contents of that file, if you specify one, control how Kubernetes API data is encrypted in etcd. If you are running the kube-apiserver without the `--encryption-provider-config` command line argument, you do not have encryption at rest enabled. If you are running the kube-apiserver with the `--encryption-provider-config` command line argument, and the file that it references specifies the `identity` provider as the first encryption provider in the list, then you do not have at-rest encryption enabled (the default `identity` provider does not provide any confidentiality protection.)

If you are running the kube-apiserver with the `--encryption-provider-config` command line argument, and the file that it references specifies a provider other than `identity` as the first encryption provider in the list, then you already have at-rest encryption enabled. However, that check does not tell you whether a previous migration to encrypted storage has succeeded. If you are not sure, see [ensure all relevant data are encrypted](#ensure-all-secrets-are-encrypted).

## Understanding the encryption at rest configuration

--- # # CAUTION: this is an example configuration. # Do not use this for your own cluster! # apiVersion: apiserver.config.k8s.io/v1 kind: EncryptionConfiguration resources: - resources: - secrets - configmaps - pandas.awesome.bears.example # a custom resource API providers: # This configuration does not provide data confidentiality. The first # configured provider is specifying the "identity" mechanism, which # stores resources as plain text. # - identity: {} # plain text, in other words NO encryption - aesgcm: keys: - name: key1 secret: c2VjcmV0IGlzIHNlY3VyZQ== - name: key2 secret: dGhpcyBpcyBwYXNzd29yZA== - aescbc: keys: - name: key1 secret: c2VjcmV0IGlzIHNlY3VyZQ== - name: key2 secret: dGhpcyBpcyBwYXNzd29yZA== - secretbox: keys: - name: key1 secret: YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXoxMjM0NTY= - resources: - events providers: - identity: {} # do not encrypt Events even though *.* is specified below - resources: - '*.apps' # wildcard match requires Kubernetes 1.27 or later provid …(trimmed)

Sources

tasks/administer-cluster/encrypt-data.md · docEncrypting Confidential Data at Rest

Related (22)

references SecretSecrets conf=1
references Static Podstatic pod conf=1
references API serverAPI server conf=1
part_of {{% heading "prerequisites" %}}describes conf=1
part_of Encrypt your data {#encrypting-your-data}describes conf=1
part_of Decrypt all data {#decrypting-all-data}describes conf=1
part_of Configure automatic reloadingdescribes conf=1
part_of {{% heading "whatsnext" %}}describes conf=1
part_of Available providers {#providers}describes conf=1
part_of Key storagedescribes conf=1
part_of Protection for encryption keysdescribes conf=1
part_of Replicate the encryption keydescribes conf=1
part_of Write an encryption configuration filedescribes conf=1
part_of Use the new encryption configuration filedescribes conf=1

← all Docs