Listing the Secrets in a Cluster
Function
This API is used to list all secrets in a cluster.
URI
GET /api/v1/secrets
Table 1 describes the parameters of this API.
|
Parameter |
Mandatory |
Description |
|---|---|---|
|
fieldSelector |
No |
A selector to restrict the list of returned objects by their fields. Defaults to everything. |
|
includeUninitialized |
No |
If true, partially initialized resources are included in the response. |
|
labelSelector |
No |
A selector to restrict the list of returned objects by their labels. Defaults to everything. |
|
pretty |
No |
If 'true', then the output is pretty printed. |
|
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 Response. |
|
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/secrets",
"resourceVersion": "1810858"
},
"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"
},
{
"metadata": {
"name": "default-token-cptf1",
"namespace": "kube-system",
"selfLink": "/api/v1/namespaces/kube-system/secrets/default-token-cptf1",
"uid": "23090a90-1425-11e7-96c7-fa163ec08232",
"resourceVersion": "32",
"creationTimestamp": "2017-03-29T02:12:19Z",
"annotations": {
"kubernetes.io/service-account.name": "default",
"kubernetes.io/service-account.uid": "23046012-1425-11e7-96c7-fa163ec08232"
}
},
"data": {
"ca.crt": "",
"namespace": "a3ViZS1zeXN0ZW0=",
"token": ""
},
"type": "kubernetes.io/service-account-token"
},
{
"metadata": {
"name": "token-kube-proxy",
"namespace": "kube-system",
"selfLink": "/api/v1/namespaces/kube-system/secrets/token-kube-proxy",
"uid": "23a5f659-1425-11e7-96c7-fa163ec08232",
"resourceVersion": "34",
"creationTimestamp": "2017-03-29T02:12:20Z"
},
"data": {
"kubeconfig": "YXBpVmVyc2lvbjogdjEKa2luZDoK"
},
"type": "Opaque"
},
{
"metadata": {
"name": "token-kubelet",
"namespace": "kube-system",
"selfLink": "/api/v1/namespaces/kube-system/secrets/token-kubelet",
"uid": "23b9cf39-1425-11e7-96c7-fa163ec08232",
"resourceVersion": "36",
"creationTimestamp": "2017-03-29T02:12:20Z"
},
"data": {
"kubeconfig": ""
},
"type": "Opaque"
},
{
"metadata": {
"name": "token-system-controller-manager",
"namespace": "kube-system",
"selfLink": "/api/v1/namespaces/kube-system/secrets/token-system-controller-manager",
"uid": "23dc783d-1425-11e7-96c7-fa163ec08232",
"resourceVersion": "39",
"creationTimestamp": "2017-03-29T02:12:20Z"
},
"data": {
"kubeconfig": ""
},
"type": "Opaque"
},
{
"metadata": {
"name": "token-system-dns",
"namespace": "kube-system",
"selfLink": "/api/v1/namespaces/kube-system/secrets/token-system-dns",
"uid": "23d31dfb-1425-11e7-96c7-fa163ec08232",
"resourceVersion": "38",
"creationTimestamp": "2017-03-29T02:12:20Z"
},
"data": {
"kubeconfig": ""
},
"type": "Opaque"
},
{
"metadata": {
"name": "token-system-scheduler",
"namespace": "kube-system",
"selfLink": "/api/v1/namespaces/kube-system/secrets/token-system-scheduler",
"uid": "23c18f3e-1425-11e7-96c7-fa163ec08232",
"resourceVersion": "37",
"creationTimestamp": "2017-03-29T02:12:20Z"
},
"data": {
"kubeconfig": ""
},
"type": "Opaque"
}
]
}
Status Code
Table 4 describes the status code of this API.
|
Status Code |
Description |
|---|---|
|
200 |
If the operation is successful, a group of secrets are returned. |
For the description about error status codes, see Status Code.
Last Article: Listing the Secrets in a Specified Namespace
Next Article: RBAC
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.