文档首页 > > API参考> Kubernetes API> ReplicaSet> 获取Replicasets

获取Replicasets

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

功能介绍

list or watch objects of kind ReplicaSet

URI

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

GET /apis/extensions/v1beta1/replicasets(Supports 1.15 and 1.15-)

表1 Query参数

参数

是否必选

参数类型

描述

continue

String

The continue option should be set when retrieving more results from the server. Since this value is server defined, clients may only use the continue value from a previous query result with identical query parameters (except for the value of continue) and the server may reject a continue value it does not recognize. If the specified continue value is no longer valid whether due to expiration (generally five to fifteen minutes) or a configuration change on the server the server will respond with a 410 ResourceExpired error indicating the client must restart their list without the continue field. This field is not supported when watch is true. Clients may start a watch from the last resourceVersion value returned by the server and not miss any modifications.

fieldSelector

String

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

includeUninitialized

Boolean

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

labelSelector

String

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

limit

Integer

limit is a maximum number of responses to return for a list call. If more items exist, the server will set the `continue` field on the list metadata to a value that can be used with the same initial query to retrieve the next set of results. Setting a limit may return fewer than the requested amount of items (up to zero items) in the event all requested objects are filtered out and clients should only use the presence of the continue field to determine whether more results are available. Servers may choose not to support the limit argument and will return all of the available results. If limit is specified and the continue field is empty, clients may assume that no more results are available. This field is not supported if watch is true.

The server guarantees that the objects returned when using continue will be identical to issuing a single list call without a limit - that is, no objects created, modified, or deleted after the first request is issued will be included in any subsequent continued requests. This is sometimes referred to as a consistent snapshot, and ensures that a client that is using limit to receive smaller chunks of a very large result can ensure they see all possible objects. If objects are updated during a chunked list the version of the object that was present at the time the first list result was calculated is returned.

pretty

String

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

resourceVersion

String

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. When specified for list: - if unset, then the result is returned from remote storage based on quorum-read flag; - if it's 0, then we simply return what we currently have in cache, no guarantee; - if set to non zero, then the result is at least as fresh as given rv.

timeoutSeconds

Integer

Timeout for the list/watch call. This limits the duration of the call, regardless of any activity or inactivity.

watch

Boolean

Watch for changes to the described resources and return them as a stream of add, update, and remove notifications. Specify resourceVersion.

请求参数

响应参数

状态码为 200 时:

表2 响应Body参数

参数

参数类型

描述

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. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources

items

Array of io.k8s.api.apps.v1.ReplicaSet objects

List of ReplicaSets. More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller

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. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds

metadata

Array of io.k8s.apimachinery.pkg.apis.meta.v1.ListMeta objects

Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds

请求示例

响应示例

状态码为 200 时:

{
    "apiVersion": "v1",
    "items": [
        {
            "apiVersion": "extensions/v1beta1",
            "kind": "ReplicaSet",
            "metadata": {
                "annotations": {
                    "deployment.kubernetes.io/desired-replicas": "2",
                    "deployment.kubernetes.io/max-replicas": "3",
                    "deployment.kubernetes.io/revision": "1"
                },
                "creationTimestamp": "2019-07-03T07:35:30Z",
                "generation": 1,
                "labels": {
                    "app": "coredns",
                    "k8s-app": "coredns",
                    "kubernetes.io/evictcritical": "",
                    "pod-template-hash": "85cb64445b",
                    "release": "cceaddon-coredns"
                },
                "name": "coredns-85cb64445b",
                "namespace": "kube-system",
                "ownerReferences": [
                    {
                        "apiVersion": "apps/v1",
                        "blockOwnerDeletion": true,
                        "controller": true,
                        "kind": "Deployment",
                        "name": "coredns",
                        "uid": "22573447-9d65-11e9-8d38-fa163eb8e88a"
                    }
                ],
                "resourceVersion": "3714356",
                "selfLink": "/apis/extensions/v1beta1/namespaces/kube-system/replicasets/coredns-85cb64445b",
                "uid": "22586f58-9d65-11e9-8d38-fa163eb8e88a"
            },
            "spec": {
                "replicas": 2,
                "selector": {
                    "matchLabels": {
                        "app": "coredns",
                        "k8s-app": "coredns",
                        "pod-template-hash": "85cb64445b"
                    }
                },
                "template": {
                    "metadata": {
                        "annotations": {
                            "checksum/config": "3095a9b4028195e7e0b8b22c550bf183d0b7a8a7eba20808b36081d0b39f8b81",
                            "scheduler.alpha.kubernetes.io/critical-pod": "",
                            "scheduler.alpha.kubernetes.io/tolerations": "[{\"key\":\"CriticalAddonsOnly\", \"operator\":\"Exists\"}]"
                        },
                        "creationTimestamp": null,
                        "labels": {
                            "app": "coredns",
                            "k8s-app": "coredns",
                            "kubernetes.io/evictcritical": "",
                            "pod-template-hash": "85cb64445b",
                            "release": "cceaddon-coredns"
                        }
                    },
                    "spec": {
                        "affinity": {
                            "podAntiAffinity": {
                                "requiredDuringSchedulingIgnoredDuringExecution": [
                                    {
                                        "labelSelector": {
                                            "matchExpressions": [
                                                {
                                                    "key": "app",
                                                    "operator": "In",
                                                    "values": [
                                                        "coredns"
                                                    ]
                                                }
                                            ]
                                        },
                                        "topologyKey": "kubernetes.io/hostname"
                                    }
                                ]
                            }
                        },
                        "containers": [
                            {
                                "args": [
                                    "-conf",
                                    "/etc/coredns/Corefile",
                                    "-rmem",
                                    "udp#8388608",
                                    "-wmem",
                                    "udp#1048576"
                                ],
                                "image": "100.79.1.215:20202/hwofficial/cce-coredns-linux-amd64:1.2.6.1",
                                "imagePullPolicy": "IfNotPresent",
                                "livenessProbe": {
                                    "failureThreshold": 5,
                                    "httpGet": {
                                        "path": "/health",
                                        "port": 8080,
                                        "scheme": "HTTP"
                                    },
                                    "initialDelaySeconds": 60,
                                    "periodSeconds": 10,
                                    "successThreshold": 1,
                                    "timeoutSeconds": 5
                                },
                                "name": "coredns",
                                "ports": [
                                    {
                                        "containerPort": 5353,
                                        "protocol": "UDP"
                                    }
                                ],
                                "readinessProbe": {
                                    "failureThreshold": 3,
                                    "httpGet": {
                                        "path": "/health",
                                        "port": 8080,
                                        "scheme": "HTTP"
                                    },
                                    "initialDelaySeconds": 3,
                                    "periodSeconds": 5,
                                    "successThreshold": 1,
                                    "timeoutSeconds": 3
                                },
                                "resources": {
                                    "limits": {
                                        "cpu": "500m",
                                        "memory": "512Mi"
                                    },
                                    "requests": {
                                        "cpu": "500m",
                                        "memory": "512Mi"
                                    }
                                },
                                "terminationMessagePath": "/dev/termination-log",
                                "terminationMessagePolicy": "File",
                                "volumeMounts": [
                                    {
                                        "mountPath": "/etc/coredns",
                                        "name": "config-volume"
                                    }
                                ]
                            }
                        ],
                        "dnsPolicy": "Default",
                        "restartPolicy": "Always",
                        "schedulerName": "default-scheduler",
                        "securityContext": {},
                        "serviceAccount": "coredns",
                        "serviceAccountName": "coredns",
                        "terminationGracePeriodSeconds": 30,
                        "tolerations": [
                            {
                                "effect": "NoExecute",
                                "key": "node.kubernetes.io/not-ready",
                                "operator": "Exists",
                                "tolerationSeconds": 60
                            },
                            {
                                "effect": "NoExecute",
                                "key": "node.kubernetes.io/unreachable",
                                "operator": "Exists",
                                "tolerationSeconds": 60
                            }
                        ],
                        "volumes": [
                            {
                                "configMap": {
                                    "defaultMode": 420,
                                    "items": [
                                        {
                                            "key": "Corefile",
                                            "path": "Corefile"
                                        }
                                    ],
                                    "name": "coredns"
                                },
                                "name": "config-volume"
                            }
                        ]
                    }
                }
            },
            "status": {
                "fullyLabeledReplicas": 2,
                "observedGeneration": 1,
                "replicas": 2
            }
        }
    ],
    "kind": "List",
    "metadata": {
        "resourceVersion": "",
        "selfLink": ""
    }
}

返回值

返回值

说明

200

OK

401

Unauthorized

错误码

分享:

    相关文档

    相关产品

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

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

*必选

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

字符长度不能超过200

提交反馈 取消

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

智能客服提问云社区提问