Listing Namespaces
Function
This API is used to obtain details about all namespaces in a cluster.
URI
GET /api/v1/namespaces
Table 1 describes the parameters of this API.
|
Parameter |
Mandatory |
Description |
|---|---|---|
|
pretty |
No |
If 'true', then the output is pretty printed. |
|
labelSelector |
No |
A selector to restrict the list of returned objects by their labels. Defaults to everything. |
|
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. |
|
watch |
No |
Watch for changes to the described resources and return them as a stream of add, update, and remove notifications. Specify resourceVersion. |
|
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. |
Request
N/A
Response
Response parameters:
Table 2 describes the response parameters.
|
Parameter |
Type |
Description |
|---|---|---|
|
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. In CamelCase. |
|
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. |
|
metadata |
metadata object |
- |
|
items |
Object |
items is the list of Namespace objects in the list. For details, see Request. |
|
Parameter |
Type |
Description |
|---|---|---|
|
selfLink |
String |
selfLink is a URL representing this object. Populated by the system. Read-only. |
|
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. |
Example response:
{
"kind": "NamespaceList",
"apiVersion": "v1",
"metadata": {
"selfLink": "/api/v1/namespaces",
"resourceVersion": "594181"
},
"items": [
{
"metadata": {
"name": "default",
"selfLink": "/api/v1/namespaces/default",
"uid": "90dd5244-5881-11e7-b5d7-fa163e08a2fd",
"resourceVersion": "6",
"creationTimestamp": "2017-06-24T02:05:16Z"
},
"spec": {
"finalizers": [
"kubernetes"
]
},
"status": {
"phase": "Active"
}
},
{
"metadata": {
"name": "kube-system",
"selfLink": "/api/v1/namespaces/kube-system",
"uid": "9178fce6-5881-11e7-b5d7-fa163e08a2fd",
"resourceVersion": "25",
"creationTimestamp": "2017-06-24T02:05:17Z"
},
"spec": {
"finalizers": [
"kubernetes"
]
},
"status": {
"phase": "Active"
}
}
]
}
Status Code
Table 4 describes the status code of this API.
|
Status Code |
Description |
|---|---|
|
200 |
This operation succeeds, and a group of Namespace resource objects is returned. |
For the description about error status codes, see Status Code.
Last Article: Replacing the Finalize Values of a Specified Namespace
Next Article: Updating a Specified Namespace
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.