Skip to content

Commit 89c99ba

Browse files
author
Tim Bannister
committed
Fix Markdown for secret encryption at rest
Adapt Markdown for CommonMark / Hugo 0.70.x
1 parent a2ff385 commit 89c99ba

File tree

1 file changed

+25
-22
lines changed

1 file changed

+25
-22
lines changed

content/en/docs/tasks/administer-cluster/encrypt-data.md

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,12 @@ but not both in the same item).
6262

6363
The first provider in the list is used to encrypt resources going into storage. When reading
6464
resources from storage each provider that matches the stored data attempts to decrypt the data in
65-
order. If no provider can read the stored data due to a mismatch in format or secret key, an error
66-
is returned which prevents clients from accessing that resource.
65+
order. If no provider can read the stored data due to a mismatch in format or secret key, an error
66+
is returned which prevents clients from accessing that resource.
6767

6868
{{< caution >}}
69-
**IMPORTANT:** If any resource is not readable via the encryption config (because keys were changed),
70-
the only recourse is to delete that key from the underlying etcd directly. Calls that attempt to
69+
**IMPORTANT:** If any resource is not readable via the encryption config (because keys were changed),
70+
the only recourse is to delete that key from the underlying etcd directly. Calls that attempt to
7171
read that resource will fail until it is deleted or a valid decryption key is provided.
7272
{{< /caution >}}
7373

@@ -117,9 +117,9 @@ To create a new secret perform the following steps:
117117

118118
1. Generate a 32 byte random key and base64 encode it. If you're on Linux or macOS, run the following command:
119119

120-
```
121-
head -c 32 /dev/urandom | base64
122-
```
120+
```shell
121+
head -c 32 /dev/urandom | base64
122+
```
123123

124124
2. Place that value in the secret field.
125125
3. Set the `--encryption-provider-config` flag on the `kube-apiserver` to point to the location of the config file.
@@ -138,33 +138,33 @@ program to retrieve the contents of your secret.
138138

139139
1. Create a new secret called `secret1` in the `default` namespace:
140140

141-
```
142-
kubectl create secret generic secret1 -n default --from-literal=mykey=mydata
143-
```
141+
```shell
142+
kubectl create secret generic secret1 -n default --from-literal=mykey=mydata
143+
```
144144

145145
2. Using the etcdctl commandline, read that secret out of etcd:
146146

147-
```
148-
   ETCDCTL_API=3 etcdctl get /registry/secrets/default/secret1 [...] | hexdump -C
149-
```
147+
`ETCDCTL_API=3 etcdctl get /registry/secrets/default/secret1 [...] | hexdump -C`
148+
149+
where `[...]` must be the additional arguments for connecting to the etcd server.
150+
151+
3. Verify the stored secret is prefixed with `k8s:enc:aescbc:v1:` which indicates the `aescbc` provider has encrypted the resulting data.
150152

151-
where `[...]` must be the additional arguments for connecting to the etcd server.
152-
3. Verify the stored secret is prefixed with `k8s:enc:aescbc:v1:` which indicates the `aescbc` provider has encrypted the resulting data.
153153
4. Verify the secret is correctly decrypted when retrieved via the API:
154154

155-
```
156-
kubectl describe secret secret1 -n default
157-
```
155+
```shell
156+
kubectl describe secret secret1 -n default
157+
```
158158

159-
should match `mykey: bXlkYXRh`, mydata is encoded, check [decoding a secret](/docs/concepts/configuration/secret#decoding-a-secret) to
160-
completely decode the secret.
159+
should match `mykey: bXlkYXRh`, mydata is encoded, check [decoding a secret](/docs/concepts/configuration/secret#decoding-a-secret) to
160+
completely decode the secret.
161161

162162

163163
## Ensure all secrets are encrypted
164164

165165
Since secrets are encrypted on write, performing an update on a secret will encrypt that content.
166166

167-
```
167+
```shell
168168
kubectl get secrets --all-namespaces -o json | kubectl replace -f -
169169
```
170170

@@ -206,7 +206,10 @@ resources:
206206
secret: <BASE 64 ENCODED SECRET>
207207
```
208208

209-
and restart all `kube-apiserver` processes. Then run the command `kubectl get secrets --all-namespaces -o json | kubectl replace -f -`
209+
and restart all `kube-apiserver` processes. Then run:
210+
```shell
211+
kubectl get secrets --all-namespaces -o json | kubectl replace -f -
212+
```
210213
to force all secrets to be decrypted.
211214

212215
{{% /capture %}}

0 commit comments

Comments
 (0)