Creating a Secret
Function
This API is used to create a secret that Kubernetes uses to process sensitive information.
URI
POST /api/v1/namespaces/{namespace}/secrets
| Parameter | Description |
|---|---|
| namespace | Object name and auth scope, such as for teams and projects. |
| Parameter | Mandatory | Description |
|---|---|---|
| pretty | No | If 'true', then the output is pretty printed. |
Request
Request parameters
For the description about request parameters, see Table 123.
Example request
{
"apiVersion": "v1",
"kind": "Secret",
"metadata": {
"name": "secret-test"
},
"type": "Opaque",
"data": {
"key1": "MWYyZDFlMmU2N2Rm",
"key2": "YWRtaW4="
}
} Response
Response parameters
For the description about response parameters, see Table 123.
Example response
{
"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": "5177770",
"creationTimestamp": "2018-09-04T03:59:19Z",
"enable": true
},
"data": {
"key1": "MWYyZDFlMmU2N2Rm",
"key2": "YWRtaW4="
},
"type": "Opaque"
} Last Article: Secret
Next Article: Replacing a Secret
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.