Updating a Secret
Function
This API is used to update some information about a specified secret.
URI
PATCH /api/v1/namespaces/{namespace}/secrets/{name}
| Parameter | Description |
|---|---|
| namespace | Object name and auth scope, such as for teams and projects. |
| name | Name of the secret. |
| Parameter | Mandatory | Description |
|---|---|---|
| pretty | No | If 'true', then the output is pretty printed. |
Request
Request parameters
For the description about the Content-Type field, see Patch Request Method Operation Description.
Example request
Content-Type: application/merge-patch+json
{
"data": {
"test2": "dGVzdA=="
}
} Response
Response parameters
For the description about response parameters, see Table 123.
Example response
Add a key-value pair "test2": "dGVzdA==" for the secret created in Creating a Secret.
{
"kind": "Secret",
"apiVersion": "v1",
"metadata": {
"name": "secret-test",
"namespace": "namespace-test",
"selfLink": "/api/v1/namespaces/namespace-test/secrets/secret-test",
"uid": "e6170b6d-aff6-11e8-8f17-c81fbe371a17",
"resourceVersion": "5199399",
"creationTimestamp": "2018-09-04T03:59:19Z",
"enable": true
},
"data": {
"key1": "MWYyZDFlMmU2N2Rm",
"key2": "YWRtaW4=",
"test2": "dGVzdA=="
},
"type": "Opaque"
} Last Article: Replacing a Secret
Next Article: Deleting a Secret
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.