文档首页 > > API参考> Kubernetes API> StatefulSet> 列出指定的StatefulSet

列出指定的StatefulSet

分享
更新时间:2020/09/18 GMT+08:00

功能介绍

This API is used to list all StatefulSet resource objects.

URI

GET /apis/apps/v1/statefulsets (Supports 1.9 and 1.9+)

GET /apis/apps/v1beta1/statefulsets (Supports 1.15 and 1.15-)

表1描述该API的参数。

表1 参数解释

参数

是否必选

描述

fieldSelector

No

A selector to restrict the list of returned objects by their fields. Defaults to everything.

pretty

No

If 'true', then the output is pretty printed.

includeUninitialized

No

If true, partially initialized resources are included in the response.

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.

labelSelector

No

A selector to restrict the list of returned objects by their labels. Defaults to everything.

请求消息

N/A

响应消息

响应参数:

表2 响应参数

参数

参数类型

描述

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.

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.

items

Object

List of StatefulSets.具体请参见表2

metadata

metadata object

Standard list metadata.

表3 metadata字段数据结构说明

参数

参数类型

描述

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.

响应示例:

{
    "kind": "StatefulSetList",
    "apiVersion": "apps/v1beta1",
    "metadata": {
        "selfLink": "/apis/apps/v1beta1/statefulsets",
        "resourceVersion": "1809953"
    },
    "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
            }
        }
    ]
}

状态码

表4描述API的状态码。

表4 状态码

状态码

描述

200

This operation succeeds, and a group of StatefulSet resource objects is returned.

异常状态码请参见状态码

分享:

    相关文档

    相关产品

文档是否有解决您的问题?

提交成功!非常感谢您的反馈,我们会继续努力做到更好!
反馈提交失败,请稍后再试!

*必选

请至少选择或填写一项反馈信息

字符长度不能超过200

提交反馈 取消

如您有其它疑问,您也可以通过华为云社区问答频道来与我们联系探讨

智能客服提问云社区提问