查看集群列表
请求信息
请求行
GET /apis/platform.tkestack.io/v1/clusters
查看类型为 Cluster 的对象列表。
请求参数
名称 | 类型 | 是否必填项 | 描述 |
---|---|---|---|
allowWatchBookmarks | boolean | 否 | allowWatchBookmarks 请求使用 BOOKMARK 类型监视事件。没有实现书签的服务器可能会忽略此标志,而书签是由服务器自行发送的。客户端不应该假定书签在任何特定的间隔被返回,也不应该假定服务器将在会话期间发送任何 BOOKMARK 事件。如果这不是 watch 请求,这个字段将被忽略。如果在 apiserver 中未启用特性门 WatchBookmarks,则忽略该字段。 |
continue | string | 否 | 服务器定义的值,⽤于从服务器中查询更多的返回结果。客户端只能从上⼀个查询结果中获取该值。当查询列表时设置了limit 参数,返回结果未包含服务器上可以查询到的所有数据,此时,会返回 continue 参数,并为 continue 参数赋值⼀个 Token。需要查询更多返回结果时,可将 continue 参数及其值作为查询参数查询更多结果。说明:如果列表配置发⽣变化或查询过期,输⼊此查询参数后,会返回 410 错误码,如果继续输⼊该查询参数进⾏查询,返回的查询结果可能不是最新的数据。 |
fieldSelector | string | 否 | 字段选择器,可通过资源对象的字段过滤、筛选资源对象,默认返回所有资源对象。 |
labelSelector | string | 否 | 标签选择器,可通过标签过滤、筛选资源对象,默认返回所有资源对象。 |
limit | integer | 否 | limit 是查询列表请求返回的最大响应数。 如果存在更多项,则服务器会将列表元数据上的 “continue” 字段设置为一个值,该值可与相同的初始查询一起使用用来检索下一组结果。如果所有请求的对象都被过滤掉了,则设置的限制返回的项目数可能少于请求的项目数(最多为零),并且客户端应仅使用 continue 字段的存在来确定是否有更多结果可用。服务器可能选择不支持 limit 参数,并将返回所有可用结果。如果指定了限制,并且 continue 字段为空,则客户端可能会认为没有更多结果可用。如果 watch 为 true,则不支持此字段。 服务器保证使用 continue 时返回的对象与发出单个列表调用无限制地相同,也就是说,在发出第一个请求后,任何创建、修改或删除的对象都不会包含在任何后续的继续请求中。有时这被称为一致快照,并确保使用限制接收非常大结果的较小块的客户端可以确保它们看到所有可能的对象。如果在分块列表期间更新对象,则将返回在计算第一个列表结果时存在的对象版本。 |
resourceVersion | string | 否 | 当指定使用 watch 请求时,将显示在资源的特定版本之后发生的更改。默认从历史开始更改。当为 list 指定时:-如果未设置,则基于 quora -read 标志从远程存储返回结果;-如果它是 0,那么我们只是返回我们目前在缓存,没有保证;-如果设置为非零,那么结果至少与给定的 resourceVersion 一样为最新的值。 |
timeoutSeconds | integer | 否 | list/watch 方法的调用超时时长。这限制了调用的持续时间,不管是否活跃。 |
watch | boolean | 否 | 监视对所描述的资源的更改,并将其作为添加、更新和删除通知的流返回。需要指定 resourceVersion。 |
pretty | string | 否 | 如果为 true,则会将返回结果输出成适合打印的格式。 |
返回信息
Content-Type
application/json
,
application/yaml
,
application/vnd.kubernetes.protobuf
,
application/json;stream=watch
,
application/vnd.kubernetes.protobuf;stream=watch
状态码: 200
OK
返回体示例
ClusterList 是一个租户拥有的完整的集群列表。
{
"apiVersion": "platform.tkestack.io/v1",
"items": [
{
"apiVersion": "platform.tkestack.io/v1",
"kind": "Cluster",
"metadata": {
"annotations": {
"cpaas.io/network-type": "kube-ovn",
"platform.tkestack.io/galaxy-ipam-ip": "10.96.0.8",
"platform.tkestack.io/gpu-quota-admission-ip": "10.96.0.9"
},
"creationTimestamp": "2021-06-21T04:10:33Z",
"labels": {
"cluster-type": "Baremetal",
"cpaas.io/arch": "amd64"
},
"name": "global",
"resourceVersion": "11982192",
"selfLink": "/apis/platform.tkestack.io/v1/clusters/global",
"uid": "6cc56a49-8ac3-45ea-916c-10fb67b9472b"
},
"spec": {
"clusterCIDR": "10.199.0.0/16",
"clusterCredentialRef": {
"name": "cc-global"
},
"displayName": "Global",
"dnsDomain": "cluster.local",
"etcd": {
"local": {
"dataDir": "/var/lib/etcd",
"serverCertSANs": [
"etcd",
"etcd.kube-system",
"192.168.0.100"
]
}
},
"features": {
"enableMasterSchedule": true,
"files": [
{
"dst": "/etc/kubernetes/audit/policy.yaml",
"src": "/app/provider/baremetal/audit/policy.yaml"
}
],
"ha": {
"thirdParty": {
"vip": "192.168.0.100",
"vport": 6443
}
},
"ipvs": true,
"skipConditions": [
"EnsureGalaxy",
"EnsureNvidiaDriver",
"EnsureKubernetesImages",
"EnsureMetricsServer"
],
"upgrade": {
"mode": "Auto",
"strategy": {
"drainNodeBeforeUpgrade": false,
"maxUnready": 0
}
}
},
"finalizers": [
"cluster"
],
"kubeletExtraArgs": {
"max-pods": "110"
},
"machines": [
{
"displayName": "",
"ip": "192.168.0.101",
"ipv6": "",
"labels": {
"node-role.kubernetes.io/master": "",
"nvidia-device-enable": "false"
},
"networkDevice": "",
"port": 22,
"proxy": {},
"publicIP": "",
"role": "",
"username": "root"
},
{
"displayName": "",
"ip": "192.168.0.102",
"ipv6": "",
"labels": {
"node-role.kubernetes.io/master": "",
"nvidia-device-enable": "false"
},
"networkDevice": "",
"port": 22,
"proxy": {},
"publicIP": "",
"role": "",
"username": "root"
},
{
"displayName": "",
"ip": "192.168.0.103",
"ipv6": "",
"labels": {
"node-role.kubernetes.io/master": "",
"nvidia-device-enable": "false"
},
"networkDevice": "",
"port": 22,
"proxy": {},
"publicIP": "",
"role": "",
"username": "root"
}
],
"networkDevice": "eth0",
"properties": {
"maxNodePodNum": 256
},
"publicAlternativeNames": [
"192.168.0.101",
"192.168.0.102",
"192.168.0.103",
"192.168.0.100"
],
"serviceCIDR": "10.96.0.0/12",
"tenantID": "default",
"type": "Baremetal",
"version": "1.19.9"
},
"status": {
"addresses": [
{
"host": "192.168.0.101",
"path": "",
"port": 6443,
"type": "Real"
},
{
"host": "192.168.0.102",
"path": "",
"port": 6443,
"type": "Real"
},
{
"host": "192.168.0.103",
"path": "",
"port": 6443,
"type": "Real"
},
{
"host": "192.168.0.100",
"path": "",
"port": 6443,
"type": "Advertise"
}
],
"clusterCIDR": "10.199.0.0/16",
"conditions": [
{
"lastProbeTime": "2021-07-01T07:58:26Z",
"lastTransitionTime": "2021-06-29T02:15:58Z",
"status": "True",
"type": "HealthCheck"
}
],
"dnsIP": "10.96.0.10",
"nodeCIDRMaskSize": 24,
"phase": "Running",
"resource": {},
"serviceCIDR": "10.96.0.0/12",
"version": "1.19.9"
}
},
{
"apiVersion": "platform.tkestack.io/v1",
"kind": "Cluster",
"metadata": {
"creationTimestamp": "2021-06-24T04:31:13Z",
"labels": {
"cluster-type": "",
"cpaas.io/arch": "amd64"
},
"name": "import-cluter",
"resourceVersion": "2032899",
"selfLink": "/apis/platform.tkestack.io/v1/clusters/import-cluter",
"uid": "5a5c2132-1811-4be0-bcaf-74ffc87701b2"
},
"spec": {
"clusterCredentialRef": {
"name": "clustercredential-zjvswlqf"
},
"displayName": "Imported-Cluster",
"dnsDomain": "cluster.local",
"features": {
"upgrade": {
"mode": "Auto",
"strategy": {
"drainNodeBeforeUpgrade": false,
"maxUnready": 0
}
}
},
"finalizers": [
"cluster"
],
"properties": {},
"tenantID": "",
"type": "Imported",
"version": ""
},
"status": {
"addresses": [
{
"host": "10.0.132.151",
"path": "",
"port": 6443,
"type": "Advertise"
}
],
"conditions": [
{
"lastProbeTime": "2021-06-24T04:31:13Z",
"lastTransitionTime": "2021-06-24T04:31:13Z",
"status": "True",
"type": "EnsureCreateClusterMark"
},
{
"lastProbeTime": "2021-07-01T08:39:06Z",
"lastTransitionTime": "2021-06-24T04:31:13Z",
"status": "True",
"type": "HealthCheck"
}
],
"phase": "Running",
"resource": {},
"version": "1.16.15"
}
}
],
"kind": "ClusterList",
"metadata": {
"resourceVersion": "12016398",
"selfLink": "/apis/platform.tkestack.io/v1/clusters"
}
}
返回体说明
名称 | 类型 | 描述 |
---|---|---|
apiVersion | string | 查看公共参数 |
items | array |
集群列表。
字段路径:items |
items[] | object |
Kubernetes 集群。
字段路径:items[] |
items[].apiVersion | string | 查看公共参数 |
items[].kind | string | 查看公共参数 |
items[].metadata | object | 查看公共参数 |
items[].spec | object |
集群的描述。
字段路径:items[].spec |
spec.clusterCIDR | string |
容器网络的子网地址(CIDR 格式),例如:10.1.0.0/16,该地址应与节点子网不同。集群创建时的 Pod 可使用该网段内的 IP。
字段路径:items[].spec.clusterCIDR |
spec.clusterCredentialRef | object |
LocalObjectReference 包含了足够多的从相同的命名空间中下载参考对象的信息。
字段路径:items[].spec.clusterCredentialRef |
clusterCredentialRef.name | string |
引用对象的名称。更多信息: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
字段路径:items[].spec.clusterCredentialRef.name |
spec.displayName | string |
集群的显示名称。
字段路径:items[].spec.displayName |
spec.dnsDomain | string |
DNSDomain 是被 k8s Service 使用的 DNS 域名。默认为 "cluster.local"。
字段路径:items[].spec.dnsDomain |
spec.etcd | object |
Etcd 包含了描述 Etcd 配置的元素。
字段路径:items[].spec.etcd |
etcd.local | object |
LocalEtcd 描述了 kubeadm 应该在本地运行 etcd 集群。
字段路径:items[].spec.etcd.local |
local.dataDir | string |
DataDir 是 etcd 存放数据的目录。默认为“/var/lib/etcd”。
字段路径:items[].spec.etcd.local.dataDir |
local.serverCertSANs | array |
ServerCertSANs 为 etcd 服务器签名证书设置额外的域名。
字段路径:items[].spec.etcd.local.serverCertSANs |
local.serverCertSANs[] | string |
字段路径:items[].spec.etcd.local.serverCertSANs[] |
spec.features | object |
ClusterFeature 记录了集群启用的特性。
字段路径:items[].spec.features |
features.enableMasterSchedule | boolean |
是否允许将应用调度到控制节点上。
字段路径:items[].spec.features.enableMasterSchedule |
features.files | array |
部署节点时额外复制的文件。
字段路径:items[].spec.features.files |
features.files[] | object |
字段路径:items[].spec.features.files[] |
files[].dst | string |
目标文件,只支持常规文件。
字段路径:items[].spec.features.files[].dst |
files[].src | string |
源文件,仅支持常规文件。
字段路径:items[].spec.features.files[].src |
features.ha | object |
字段路径:items[].spec.features.ha |
ha.thirdParty | object |
字段路径:items[].spec.features.ha.thirdParty |
thirdParty.vip | string |
第三方 HA(Highly Available) 的虚拟 IP。
字段路径:items[].spec.features.ha.thirdParty.vip |
thirdParty.vport | integer (int32) |
第三方 HA(Highly Available) 的虚拟端口。
字段路径:items[].spec.features.ha.thirdParty.vport |
features.ipvs | boolean |
Ipvs 开关。
字段路径:items[].spec.features.ipvs |
features.skipConditions | array |
SkipConditions 是一系列需要被跳过的状态。
字段路径:items[].spec.features.skipConditions |
features.skipConditions[] | string |
字段路径:items[].spec.features.skipConditions[] |
features.upgrade | object |
字段路径:items[].spec.features.upgrade |
upgrade.mode | string |
升级模式,默认值为 Auto。
字段路径:items[].spec.features.upgrade.mode |
upgrade.strategy | object |
用于控制升级过程的策略。
字段路径:items[].spec.features.upgrade.strategy |
strategy.drainNodeBeforeUpgrade | boolean |
升级前是否逐出节点上的 Pod。如果你的 Pod 不能接受被逐出当前节点,这个值应该是 false。
字段路径:items[].spec.features.upgrade.strategy.drainNodeBeforeUpgrade |
strategy.maxUnready | string (int-or-string) |
IntOrString 是一种可以保存 int32 或 string 的类型。当在 JSON 或 YAML 编组和解组中使用时,它会生成或使用内部类型。例如,这允许您拥有一个可以接受名称或数字的 JSON 字段。
字段路径:items[].spec.features.upgrade.strategy.maxUnready |
spec.finalizers | array |
终结器是一个内部的值列表,必须为空才能从存储中永久删除对象。
字段路径:items[].spec.finalizers |
spec.finalizers[] | string |
字段路径:items[].spec.finalizers[] |
spec.kubeletExtraArgs | object |
Kubelet 额外的配置参数。
字段路径:items[].spec.kubeletExtraArgs |
spec.machines | array |
集群节点,代表集群中的控制节点。
字段路径:items[].spec.machines |
spec.machines[] | object |
ClusterMachine 是集群的 master 节点定义。
字段路径:items[].spec.machines[] |
machines[].displayName | string |
显示名称。
字段路径:items[].spec.machines[].displayName |
machines[].ip | string |
字段路径:items[].spec.machines[].ip |
machines[].ipv6 | string |
IPV6 地址。
字段路径:items[].spec.machines[].ipv6 |
machines[].labels | object |
字段路径:items[].spec.machines[].labels |
machines[].networkDevice | string |
网络设备(网卡)名称。
字段路径:items[].spec.machines[].networkDevice |
machines[].port | integer (int32) |
字段路径:items[].spec.machines[].port |
machines[].proxy | object |
通过 SSH 服务访问节点的代理。
字段路径:items[].spec.machines[].proxy |
machines[].publicIP | string |
节点的公网 IP。
字段路径:items[].spec.machines[].publicIP |
machines[].role | string |
节点的类型,控制节点(master)/计算节点(node)。
字段路径:items[].spec.machines[].role |
machines[].username | string |
字段路径:items[].spec.machines[].username |
spec.networkDevice | string |
网卡设备。
字段路径:items[].spec.networkDevice |
spec.properties | object |
ClusterProperty 记录了集群的属性信息。
字段路径:items[].spec.properties |
properties.maxNodePodNum | integer (int32) |
节点上允许调度的最大 Pod 数。
字段路径:items[].spec.properties.maxNodePodNum |
spec.publicAlternativeNames | array |
签发到证书中的 APIServer 访问地址,只能填写 IP 或域名,最多 253 个字符。
字段路径:items[].spec.publicAlternativeNames |
spec.publicAlternativeNames[] | string |
字段路径:items[].spec.publicAlternativeNames[] |
spec.serviceCIDR | string |
Kubernetes Service 的网络地址范围(CIDR 格式),例如:10.96.0.0/12,不可与 Cluster CIDR 的网段重叠。与 MaxClusterServiceNum 互斥。
字段路径:items[].spec.serviceCIDR |
spec.tenantID | string |
租户 ID。
字段路径:items[].spec.tenantID |
spec.type | string |
集群类型,自建或接入。
字段路径:items[].spec.type |
spec.version | string |
集群的版本。
字段路径:items[].spec.version |
items[].status | object |
ClusterStatus 代表集群状态的信息。
字段路径:items[].status |
status.addresses | array |
可到达集群的地址列表。
字段路径:items[].status.addresses |
status.addresses[] | object |
ClusterAddress 包含了集群地址的信息。
字段路径:items[].status.addresses[] |
addresses[].host | string |
集群地址。
字段路径:items[].status.addresses[].host |
addresses[].path | string |
集群地址的 IP 地址或域名。
字段路径:items[].status.addresses[].path |
addresses[].port | integer (int32) |
集群地址端口号。
字段路径:items[].status.addresses[].port |
addresses[].type | string |
集群地址的类型,包括 Public、ExternalIP、InternalIP。
字段路径:items[].status.addresses[].type |
status.clusterCIDR | string |
ClusterCIDR 是容器网络的子网地址(CIDR 格式),例如:10.1.0.0/16,该地址应与节点子网不同。集群创建时的 Pod 可使用该网段内的 IP。
字段路径:items[].status.clusterCIDR |
status.conditions | array |
集群的执行进度。
字段路径:items[].status.conditions |
status.conditions[] | object |
ClusterCondition 包括该集群当前条件的详细信息。
字段路径:items[].status.conditions[] |
conditions[].lastProbeTime | string (date-time) |
Time 是时间的包装。Time 支持正确的封送到 YAML 和 JSON。时间包提供方的许多工厂方法都提供了包装器。
字段路径:items[].status.conditions[].lastProbeTime |
conditions[].lastTransitionTime | string (date-time) |
Time 是时间的包装。Time 支持正确的封送到 YAML 和 JSON。时间包提供方的许多工厂方法都提供了包装器。
字段路径:items[].status.conditions[].lastTransitionTime |
conditions[].status | string |
条件的状态,可以是 True、False、Unknown。
字段路径:items[].status.conditions[].status |
conditions[].type | string |
条件的类型。
字段路径:items[].status.conditions[].type |
status.dnsIP | string |
域名的 IP。
字段路径:items[].status.dnsIP |
status.nodeCIDRMaskSize | integer (int32) |
节点的 CIDR 掩码大小。
字段路径:items[].status.nodeCIDRMaskSize |
status.phase | string |
集群的执行进度阶段。
字段路径:items[].status.phase |
status.resource | object |
ClusterResource 记录了集群的当前可用的最大资源配额信息。
字段路径:items[].status.resource |
status.serviceCIDR | string |
Kubernetes Service 的网络地址范围(CIDR 格式),例如:10.96.0.0/12,不可与 Cluster CIDR 的网段重叠。与 MaxClusterServiceNum 互斥。
字段路径:items[].status.serviceCIDR |
status.version | string |
集群版本。
字段路径:items[].status.version |
kind | string | 查看公共参数 |
metadata | object | 查看公共参数 |