Listing the Secrets in a Specified Namespace
Function
This API is used to list the secrets in a specified namespace.
URI
GET /api/v1/namespaces/{namespace}/secrets
Table 1 describes the parameters of this API.
|
Parameter |
Mandatory |
Description |
|---|---|---|
|
namespace |
Yes |
Object name and auth scope, such as for teams and projects. |
|
pretty |
No |
If 'true', then the output is pretty printed. |
|
fieldSelector |
No |
A selector to restrict the list of returned objects by their fields. Defaults to everything. |
|
includeUninitialized |
No |
A selector to restrict the list of returned objects by their fields. Defaults to everything. |
|
labelSelector |
No |
A selector to restrict the list of returned objects by their labels. Defaults to everything. |
|
resourceVersion |
No |
When specified with a watch call, shows changes that occur after that particular version of a resource. Defaults to changes from the beginning of history. |
|
timeoutSeconds |
No |
Timeout for the list/watch call. |
|
watch |
No |
Watch for changes to the described resources and return them as a stream of add, update, and remove notifications. Specify resourceVersion. |
Request
N/A
Response
Response parameters:
|
Parameter |
Type |
Description |
|---|---|---|
|
apiVersion |
String |
APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. |
|
kind |
String |
Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. |
|
metadata |
metadata object |
Standard list metadata. |
|
items |
Object |
List of Services. For details, see Table 2. |
|
Parameter |
Type |
Description |
|---|---|---|
|
resourceVersion |
String |
String that identifies the server's internal version of this object that can be used by clients to determine when objects have changed. Value must be treated as opaque by clients and passed unmodified back to the server. Populated by the system. Read-only. |
|
selfLink |
String |
SelfLink is a URL representing this object. Populated by the system. Read-only. |
Example Response:
{
"kind": "SecretList",
"apiVersion": "v1",
"metadata": {
"selfLink": "/api/v1/namespaces/default/secrets",
"resourceVersion": "1810323"
},
"items": [
{
"metadata": {
"name": "default-token-nlckn",
"namespace": "default",
"selfLink": "/api/v1/namespaces/default/secrets/default-token-nlckn",
"uid": "23070e11-1425-11e7-96c7-fa163ec08232",
"resourceVersion": "30",
"creationTimestamp": "2017-03-29T02:12:19Z",
"annotations": {
"kubernetes.io/service-account.name": "default",
"kubernetes.io/service-account.uid": "2303e59b-1425-11e7-96c7-fa163ec08232"
}
},
"data": {
"ca.crt": "",
"namespace": "ZGVmYXVsdA==",
"token": ""
},
"type": "kubernetes.io/service-account-token"
},
{
"metadata": {
"name": "myregistry",
"namespace": "default",
"selfLink": "/api/v1/namespaces/default/secrets/myregistry",
"uid": "a34ed5e4-1427-11e7-96c7-fa163ec08232",
"resourceVersion": "1243",
"creationTimestamp": "2017-03-29T02:30:13Z"
},
"data": {
".dockercfg": ""
},
"type": "kubernetes.io/hwdockercfg"
},
{
"metadata": {
"name": "paas.elb",
"namespace": "default",
"selfLink": "/api/v1/namespaces/default/secrets/paas.elb",
"uid": "a34df6f3-1427-11e7-96c7-fa163ec08232",
"resourceVersion": "1242",
"creationTimestamp": "2017-03-29T02:30:13Z"
},
"data": {
"access.key": "",
"secret.key": ""
},
"type": "Opaque"
}
]
}
Status Code
Table 4 describes the status code of this API.
|
Status Code |
Description |
|---|---|
|
200 |
This operation succeeds, and a secret resource object is returned. |
For the description about error status codes, see Status Code.
Last Article: Replacing a Specified Secret
Next Article: Listing the Secrets in a Cluster
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.