搜索看看
数据开放接口 / 获取K8S列表接口
(需要升级到v3.4.8或以上版本)
1、示例,下面【2】是参数说明:
请求URL:http://localhost:9999/k8sMonitor/agentList 请求方式:POST 请求参数(Content-Type:application/json): { "wgToken":"65d05df102851c6535322e73b2f99c06", "k8sName":"myK8s", "dataType":"service" } 返回结果: { "msg": "", "code": "0", "data": [ { "dataType": "deployment", "pageSize": 20, "dataJson": "{\"startedTime\":\"2023-07-09 06:21:09\",\"k8sName\":\"北京项目节点k8s\",\"name\":\"coredns\",\"namespace\":\"kube-system\"}", "k8sName": "北京项目节点k8s", "createTime": 1689240032000, "id": "1679420535357964317", "page": 1 }, { "dataType": "deployment", "pageSize": 20, "dataJson": "{\"startedTime\":\"2023-07-09 06:23:16\",\"k8sName\":\"北京项目节点k8s\",\"name\":\"calico-kube-controllers\",\"namespace\":\"kube-system\"}", "k8sName": "北京项目节点k8s", "createTime": 1689240032000, "id": "1679420535357964316", "page": 1 }, { "dataType": "namespace", "pageSize": 20, "dataJson": "{\"startedTime\":\"2023-07-09 06:21:07\",\"k8sName\":\"北京项目节点k8s\",\"name\":\"default\"}", "k8sName": "北京项目节点k8s", "createTime": 1689240032000, "id": "1679420535357964288", "page": 1 } ] }
2、参数说明:
请求参数(Content-Type:application/json): { "wgToken":"必填,server/config/application.yml里的wgToken配置项的md5加密字符串,大小写均可", "k8sName":"非必填,k8s集群的自定义的名称", "dataType":"非必填,数据类型,包括namespace,pod,service,container,node" } 返回结果: { "msg":"错误信息", "code":"0成功1错误", "data":[ { "dataType": "数据类型,包括namespace,pod,service,container,node", "dataJson": "数据内容,JSON格式", "k8sName": "k8s集群名称", "createTime": "创建时间,毫秒", "id": "1679420535357964317" } ] }