Listing a StatefulSet in a Specified Namespace
Function
This API is used to list all StatefulSet resource objects under a specified Namespace.
URI
GET /apis/apps/v1/namespaces/{namespace}/statefulsets (for clusters of v1.9 and later)
GET /apis/apps/v1beta1/namespaces/{namespace}/statefulsets (for clusters of v1.15 and earlier)
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. |
|
includeUninitialized |
No |
If true, partially initialized resources are included in the response. |
|
fieldSelector |
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:
For the description about response parameters, see Table 2.
Example response:
{
"kind": "StatefulSetList",
"apiVersion": "apps/v1beta1",
"metadata": {
"selfLink": "/apis/apps/v1beta1/namespaces/default/statefulsets",
"resourceVersion": "1809849"
},
"items": [
{
"metadata": {
"name": "mysql",
"generateName": "sz",
"namespace": "default",
"selfLink": "/apis/apps/v1beta1/namespaces/default/statefulsets/mysql",
"uid": "f5cf50f5-23fc-11e7-9c83-fa163ec08232",
"resourceVersion": "1809843",
"generation": 1,
"creationTimestamp": "2017-04-18T06:05:02Z",
"labels": {
"app": "mysql"
}
},
"spec": {
"replicas": 1,
"selector": {
"matchLabels": {
"app": "mysql"
}
},
"template": {
"metadata": {
"name": "-sz",
"creationTimestamp": null,
"labels": {
"app": "mysql"
}
},
"spec": {
"containers": [
{
"name": "container01",
"image": "10.154.52.159:443/test/nginx:latest",
"ports": [
{
"containerPort": 80,
"protocol": "TCP"
}
],
"resources": {},
"terminationMessagePath": "/dev/termination-log",
"imagePullPolicy": "IfNotPresent"
}
],
"restartPolicy": "Always",
"terminationGracePeriodSeconds": 30,
"dnsPolicy": "ClusterFirst",
"securityContext": {}
}
},
"volumeClaimTemplates": [
{
"metadata": {
"name": "db",
"creationTimestamp": null
},
"spec": {
"accessModes": [
"ReadWriteOnce"
],
"resources": {
"requests": {
"storage": "1Gi"
}
}
},
"status": {
"phase": "Pending"
}
}
],
"serviceName": "mysql-service"
},
"status": {
"replicas": 1
}
}
]
}
Status Code
Table 2 describes the status code of this API.
|
Status Code |
Description |
|---|---|
|
200 |
This operation succeeds, and a StatefulSet resource object is returned. |
For the description about error status codes, see Status Code.
Last Article: Replacing the Status of a Specified StatefulSet
Next Article: Listing All StatefulSets
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.