⎈ k8s knowledge compiler

Decrypt Confidential Data that is Already Encrypted 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 switch from encryption of API data at rest, so that API data are stored unencrypted. You might want to do this to improve performance; usually, though, if it was a good idea to encrypt some data, it's also a good idea to leave them encrypted.

> 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 wanted to manage encryption for 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.

* You should have some API data that are already encrypted.

## Determine whether encryption at rest is already enabled

By default, the API server uses an `identity` provider that stores plain-text representations of resources. The default `identity` provider does not provide any confidentiality protection.

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 it is not specified, you do not have encryption at rest enabled.

The format of that configuration file is YAML, representing a configuration API kind named [`EncryptionConfiguration`](/docs/reference/config-api/apiserver-config.v1/). You can see an example configuration in [Encryption at rest configuration](/docs/tasks/administer-cluster/encrypt-data/#understanding-the-encryption-at-rest-configuration).

If `--encryption-provider-config` is set, check which resources (such as `secrets`) are configured for encryption, and what provider is used. Make sure that the preferred provider for that resource type is not `identity`; you only set `identity` (_no encryption_) as default when you want to disable encryption at rest. Verify that the first-listed provider for a resource is something other than `identity`, which means that any new information written to resources of that type will be encrypted as configured. If you do see `identity` as the first-listed provider for any resource, this means that those resources are being written out to etcd without encryption.

## Decrypt all data {#decrypting-all-data}

This example shows how to stop encrypting the Secret API at rest. If you are encrypting other API kinds, adjust the steps to match.

### Locate the encryption configuration file

First, find the API server configuration files. On each control plane node, static Pod manifest for the kube-apiserver specifies a command line argument, `--encryption-provider-config`. You are likely to find that this file is mounted into the static Pod using a [`hostPath`](/docs/concepts/storage/volumes/#hostpath) volume mount. Once you locate the volume you can find the file on the node filesystem and inspect it.

### Configure the API server to decrypt objects

To disable encryption at rest, place the `identity` provider as the first entry in your encryption configuration file.

For example, if your existing EncryptionConfiguration file reads: ```yaml --- apiVersion: apiserver.config.k8s.io/v1 kind: EncryptionConfiguration resources: - resources: - secrets providers: - …(trimmed)

Sources

tasks/administer-cluster/decrypt-data.md · docDecrypt Confidential Data that is Already Encrypted at Rest

Related (11)

references SecretSecrets conf=1
references Static Podstatic pod conf=1
part_of {{% heading "prerequisites" %}}describes conf=1
part_of Decrypt all data {#decrypting-all-data}describes conf=1
part_of {{% heading "whatsnext" %}}describes conf=1
part_of Locate the encryption configuration filedescribes conf=1
part_of Configure the API server to decrypt objectsdescribes conf=1
part_of Force decryptiondescribes conf=1

← all Docs