secret.md: add an example of editing a secret (#15464)

This commit is contained in:
Eric Hu 2019-07-21 10:32:53 +07:00 committed by Kubernetes Prow Robot
parent 55e6801033
commit 7dae226a96
1 changed files with 32 additions and 0 deletions

View File

@ -359,6 +359,38 @@ echo 'MWYyZDFlMmU2N2Rm' | base64 --decode
1f2d1e2e67df
```
#### Editing a Secret
An existing secret may be edited with the following command:
```shell
kubectl edit secrets mysecret
```
This will open the default configured editor and allow for updating the base64 encoded secret values in the `data` field:
```
# Please edit the object below. Lines beginning with a '#' will be ignored,
# and an empty file will abort the edit. If an error occurs while saving this file will be
# reopened with the relevant failures.
#
apiVersion: v1
data:
username: YWRtaW4=
password: MWYyZDFlMmU2N2Rm
kind: Secret
metadata:
annotations:
kubectl.kubernetes.io/last-applied-configuration: { ... }
creationTimestamp: 2016-01-22T18:41:56Z
name: mysecret
namespace: default
resourceVersion: "164619"
selfLink: /api/v1/namespaces/default/secrets/mysecret
uid: cfee02d6-c137-11e5-8d73-42010af00002
type: Opaque
```
## Using Secrets
Secrets can be mounted as data volumes or be exposed as