Reading a StatefulSet
Function
This API is used to read a StatefulSet under a specified namespace.
URI
GET /apis/apps/v1beta1/namespaces/{namespace}/statefulsets/{name}
Table 1 describes the parameters of this API.
|
Parameter |
Mandatory |
Description |
|---|---|---|
|
name |
Yes |
Name of the StatefulSet. |
|
namespace |
Yes |
Namespace to which the StatefulSet you want to query belongs. |
|
pretty |
No |
If 'true', then the output is pretty printed. |
|
exact |
No |
Should the export be exact. Exact export maintains cluster-specific fields like 'Namespace'. |
|
export |
No |
Should this value be exported. Export strips fields that a user cannot specify. |
Request
N/A
Response
Response parameters
For the description about response parameters, see Table 2.
Example response
{
"kind": "StatefulSet",
"apiVersion": "apps/v1beta1",
"metadata": {
"name": "statefulset-test",
"namespace": "8f6c39e7c269440c881bba2fc49586d6",
"selfLink": "/apis/apps/v1beta1/namespaces/8f6c39e7c269440c881bba2fc49586d6/statefulsets/statefulset-test",
"uid": "ee0ef0d0-2728-11e8-8930-84a9c46e8ca3",
"resourceVersion": "4510955",
"generation": 1,
"creationTimestamp": "2018-03-14T01:42:18Z",
"labels": {
"appgroup": ""
},
"annotations": {
"description": ""
},
"enable": true
},
"spec": {
"replicas": 2,
"selector": {
"matchLabels": {
"app": "statefulset-test"
}
},
"template": {
"metadata": {
"creationTimestamp": null,
"labels": {
"app": "statefulset-test"
},
"annotations": {
"com.huawei.scheduler/container-type": "secure-container",
"metrics.alpha.kubernetes.io/custom-endpoints": "[{api:'',path:'',port:'',names:''}]",
"pod.alpha.kubernetes.io/initialized": "true"
},
"enable": true
},
"spec": {
"containers": [
{
"name": "container-0",
"image": "undefined:undefined",
"resources": {
"limits": {
"cpu": "1",
"memory": "2Gi"
},
"requests": {
"cpu": "1",
"memory": "2Gi"
}
},
"lifecycle": {},
"terminationMessagePath": "/dev/termination-log",
"terminationMessagePolicy": "File",
"imagePullPolicy": "IfNotPresent"
},
{
"name": "container-1",
"image": "nginx:latest",
"resources": {
"limits": {
"cpu": "1",
"memory": "2Gi"
},
"requests": {
"cpu": "1",
"memory": "2Gi"
}
},
"lifecycle": {},
"terminationMessagePath": "/dev/termination-log",
"terminationMessagePolicy": "File",
"imagePullPolicy": "Always"
}
],
"restartPolicy": "Always",
"terminationGracePeriodSeconds": 30,
"dnsPolicy": "ClusterFirst",
"securityContext": {},
"imagePullSecrets": [
{
"name": "imagepull-secret"
}
],
"affinity": {},
"schedulerName": "default-scheduler"
}
},
"serviceName": "test",
"podManagementPolicy": "OrderedReady",
"updateStrategy": {
"type": "RollingUpdate"
},
"revisionHistoryLimit": 10
},
"status": {
"observedGeneration": 1,
"replicas": 1,
"currentReplicas": 1,
"currentRevision": "statefulset-test-2238135242",
"updateRevision": "statefulset-test-2238135242"
}
}
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 more status codes, see Status Codes.
Last Article: Creating a 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.