文档首页/ 企业主机安全 HSS/ API参考/ API说明/ 容器安装与配置/ 获取多云集群的代理安装脚本 - ShowMultiCloudClusterProxyScript
更新时间:2025-10-31 GMT+08:00
分享

获取多云集群的代理安装脚本 - ShowMultiCloudClusterProxyScript

功能介绍

获取多云集群的代理安装脚本

授权信息

账号具备所有API的调用权限,如果使用账号下的IAM用户调用当前API,该IAM用户需具备调用API所需的权限。

  • 如果使用角色与策略授权,具体权限要求请参见权限和授权项
  • 如果使用身份策略授权,当前API调用无需身份策略权限。

URI

GET /v5/{project_id}/container/kubernetes/multi-cloud/clusters/{cluster_id}/agent/install-script

表1 路径参数

参数

是否必选

参数类型

描述

project_id

String

参数解释:

项目ID,用于明确项目归属,配置后可通过该ID查询项目下资产。获取方式请参见获取项目ID

约束限制:

不涉及

取值范围:

字符长度1-256位

默认取值:

不涉及

cluster_id

String

集群id

表2 Query参数

参数

是否必选

参数类型

描述

enterprise_project_id

String

参数解释:

企业项目ID,用于过滤不同企业项目下的资产。获取方式请参见获取企业项目ID

如需查询所有企业项目下的资产请传参“all_granted_eps”。

约束限制:

开通企业项目功能后才需要配置企业项目ID参数。

取值范围:

字符长度1-256位

默认取值:

0,表示默认企业项目(default)。

请求参数

表3 请求Header参数

参数

是否必选

参数类型

描述

X-Auth-Token

String

参数解释:

用户Token,包含了用户的身份、权限等信息,在调用API接口时,可通过Token进行身份认证。获取方式请参见获取用户Token

约束限制:

不涉及

取值范围:

字符长度1-32768位

默认取值:

不涉及

响应参数

状态码:200

表4 响应Body参数

参数

参数类型

描述

install_script

String

代理安装脚本

请求示例

获取多云集群的代理安装脚本

GET https://{endpoint}/v5/{project_id}/container/kubernetes/multi-cloud/clusters/1257efb7-4f64-4f7f-9be8-fdaabbbf77b5/agent/install-script?enterprise_project_id=all_granted_eps

响应示例

状态码:200

请求已成功

{
  "install_script" : "{\"metadata\":{\"namespace\":\"hss\",\"name\":\"hssRole\"},\"apiVersion\":\"rbac.authorization.k8s.io/v1\",\"kind\":\"Role\",\"rules\":[{\"resources\":[\"configmaps\"],\"verbs\":[\"create\",\"delete\",\"deletecollection\",\"get\",\"list\",\"patch\",\"update\",\"watch\"],\"apiGroups\":[\"\"]},{\"resources\":[\"daemonsets\",\"deployments\",\"deployments/rollback\",\"replicasets\"],\"verbs\":[\"create\",\"delete\",\"deletecollection\",\"get\",\"list\",\"patch\",\"update\",\"watch\"],\"apiGroups\":[\"apps\"]},{\"resources\":[\"cronjobs\",\"jobs\"],\"verbs\":[\"create\",\"delete\",\"deletecollection\",\"get\",\"list\",\"patch\",\"update\",\"watch\"],\"apiGroups\":[\"batch\"]},{\"resources\":[\"ingresses\"],\"verbs\":[\"create\",\"delete\",\"deletecollection\",\"get\",\"list\",\"patch\",\"update\",\"watch\"],\"apiGroups\":[\"extensions\"]},{\"resources\":[\"ingresses\"],\"verbs\":[\"create\",\"delete\",\"deletecollection\",\"get\",\"list\",\"patch\",\"update\",\"watch\"],\"apiGroups\":[\"networking.k8s.io\"]}]}{\"metadata\":{\"namespace\":\"hss\",\"name\":\"hssRoleBinding\"},\"apiVersion\":\"rbac.authorization.k8s.io/v1\",\"kind\":\"RoleBinding\",\"subjects\":[{\"kind\":\"ServiceAccount\",\"name\":\"hss-user\",\"namespace\":\"hss\"}],\"roleRef\":{\"apiGroup\":\"rbac.authorization.k8s.io\",\"kind\":\"Role\",\"name\":\"hssRole\"}}{\"metadata\":{\"name\":\"hssClusterRole\"},\"apiVersion\":\"rbac.authorization.k8s.io/v1\",\"kind\":\"ClusterRole\",\"rules\":[{\"resources\":[\"namespaces\",\"pods\",\"nodes\",\"services\",\"endpoints\",\"configmaps\",\"events\",\"persistentvolumeclaims\",\"persistentvolumes\",\"podtemplates\",\"repli\"],\"verbs\":[\"get\",\"list\"],\"apiGroups\":[\"\"]},{\"resources\":[\"pods/status\"],\"verbs\":[\"update\"],\"apiGroups\":[\"\"]},{\"resources\":[\"daemonsets\",\"deployments\",\"replicasets\",\"statefulsets\"],\"verbs\":[\"get\",\"list\"],\"apiGroups\":[\"apps\"]},{\"resources\":[\"horizontalpodautoscalers\"],\"verbs\":[\"get\",\"list\"],\"apiGroups\":[\"autoscaling\"]},{\"resources\":[\"cronjobs\",\"jobs\"],\"verbs\":[\"get\",\"list\"],\"apiGroups\":[\"batch\"]},{\"resources\":[\"endpointslices\"],\"verbs\":[\"get\",\"list\"],\"apiGroups\":[\"discovery.k8s.io\"]},{\"resources\":[\"events\"],\"verbs\":[\"get\",\"list\"],\"apiGroups\":[\"events.k8s.io\"]},{\"resources\":[\"ingresses\"],\"verbs\":[\"get\",\"list\"],\"apiGroups\":[\"extensions\"]},{\"resources\":[\"ingressclasses\",\"ingresses\",\"networkpolicies\"],\"verbs\":[\"create\",\"delete\",\"update\",\"get\",\"list\"],\"apiGroups\":[\"networking.k8s.io\"]},{\"resources\":[\"clusterrolebindings\",\"clusterroles\",\"rolebindings\",\"roles\"],\"verbs\":[\"create\",\"delete\",\"deletecollection\",\"patch\",\"update\",\"watch\"],\"apiGroups\":[\"rbac.authorization.k8s.io\"]},{\"resources\":[\"clusterrolebindings\",\"clusterroles\",\"rolebindings\",\"roles\"],\"verbs\":[\"get\",\"list\"],\"apiGroups\":[\"rbac.authorization.k8s.io\"]},{\"resources\":[\"storageclasses\",\"volumeattachments\"],\"verbs\":[\"get\",\"list\"],\"apiGroups\":[\"storage.k8s.io\"]}]}{\"metadata\":{\"name\":\"hssClusterRoleBinding\"},\"apiVersion\":\"rbac.authorization.k8s.io/v1\",\"kind\":\"ClusterRoleBinding\",\"subjects\":[{\"kind\":\"ServiceAccount\",\"name\":\"hss-user\",\"namespace\":\"hss\"}],\"roleRef\":{\"apiGroup\":\"rbac.authorization.k8s.io\",\"kind\":\"ClusterRole\",\"name\":\"hssClusterRole\"}}{\"apiVersion\":\"v1\",\"kind\":\"Secret\",\"metadata\":{\"name\":\"proxy-agent-cert\",\"namespace\":\"hss\"},\"type\":\"Opaque\",\"data\":{\"ca.crt\":\"LxxxCg==\",\"proxy-agent.crt\":\"Q2VydxxxxLQo=\",\"proxy-agent.key\":\"MxxxBGMA==\",\"common_shared.key\":\"AQdxxxxH+g==\",\"root.key\":\"xxxxk4w==\"}}{\"apiVersion\":\"apps/v1\",\"kind\":\"Deployment\",\"metadata\":{\"labels\":{\"app\":\"proxy-agent\",\"version\":\"0.0.2\"},\"name\":\"proxy-agent\",\"namespace\":\"hss\"},\"spec\":{\"replicas\":2,\"selector\":{\"matchLabels\":{\"app\":\"proxy-agent\"}},\"strategy\":{\"rollingUpdate\":{\"maxSurge\":1,\"maxUnavailable\":1},\"type\":\"RollingUpdate\"},\"template\":{\"metadata\":{\"labels\":{\"app\":\"proxy-agent\"}},\"spec\":{\"affinity\":{\"podAntiAffinity\":{\"requiredDuringSchedulingIgnoredDuringExecution\":[{\"labelSelector\":{\"matchExpressions\":[{\"key\":\"app\",\"operator\":\"In\",\"values\":[\"proxy-agent\"]}]},\"topologyKey\":\"kubernetes.io/hostname\"}]}},\"containers\":[{\"command\":[\"/proxy-agent\"],\"args\":[\"--logtostderr=true\",\"--ca-cert=/var/certs/agent/ca.crt\",\"--agent-cert=/var/certs/agent/proxy-agent.crt\",\"--agent-key=/var/certs/agent/proxy-agent.key\",\"--proxy-server-host=hss-anp.cn-north-7.myhuaweicloud.com\",\"--proxy-server-port=8091\",\"--agent-id=6f2b5593-7855-4dbd-aebe-4f736708b8db\",\"--agent-identifiers=host=lb.kubesphere.local\"],\"image\":\"swr.cn-north-7.myhuaweicloud.com/scc_hss_container/proxy-agent:0.0.2\",\"imagePullPolicy\":\"IfNotPresent\",\"name\":\"proxy-agent\",\"env\":[{\"name\":\"PAAS_CRYPTO_PATH\",\"value\":\"/home/certs\"}],\"resources\":{\"requests\":{\"cpu\":\"40m\",\"memory\":\"50Mi\"},\"limits\":{\"cpu\":\"300m\",\"memory\":\"300Mi\"}},\"securityContext\":{\"readOnlyRootFilesystem\":true,\"allowPrivilegeEscalation\":false},\"livenessProbe\":{\"exec\":{\"command\":[\"/bin/sh\",\"-ec\",\"status=$(curl                -k -m 5 -s -o /dev/null -w \\\"%{http_code}\\\"  http://127.0.0.1:8093/healthz);[ $status -ge 200 ] && echo $status\"]},\"initialDelaySeconds\":15,\"timeoutSeconds\":60},\"volumeMounts\":[{\"mountPath\":\"/var/certs/agent/ca.crt\",\"name\":\"cert\",\"subPath\":\"ca.crt\"},{\"mountPath\":\"/var/certs/agent/proxy-agent.crt\",\"name\":\"cert\",\"subPath\":\"proxy-agent.crt\"},{\"mountPath\":\"/var/certs/agent/proxy-agent.key\",\"name\":\"cert\",\"subPath\":\"proxy-agent.key\"},{\"mountPath\":\"/home/certs/common_shared.key\",\"name\":\"cert\",\"subPath\":\"common_shared.key\"},{\"mountPath\":\"/home/certs/root.key\",\"name\":\"cert\",\"subPath\":\"root.key\"}]}],\"dnsPolicy\":\"Default\",\"hostNetwork\":true,\"volumes\":[{\"name\":\"cert\",\"secret\":{\"secretName\":\"proxy-agent-cert\"}}]}}}}"
}

状态码

状态码

描述

200

请求已成功

错误码

请参见错误码

相关文档