尝试在doc之后使用kubernetes API检索kubernetes集群的详细信息,如名称空间和pod详细信息
接口:
<publicServiceEndpointURL>/api/v1/namespaces
Headers:
Authorization: bearer <id_token>
<id_token>
-生成的IAM令牌。
将在启用了SSL证书的postman上收到证书错误,否则将抛出403禁止错误
Error: unable to verify the first certificate
禁用SSL证书验证的结果。
{
"kind": "Status",
"apiVersion": "v1",
"metadata": {},
"status": "Failure",
"message": "namespaces is forbidden: User \"system:anonymous\" cannot list resource \"namespaces\" in API group \"\" at the cluster scope",
"reason": "Forbidden",
"details": {
"kind": "namespaces"
},
"code": 403
}
尝试使用curl,并将导致相同的错误
curl -k <publicServiceEndpointURL>/api/v1/namespaces -H "Authorization: Bearer <token>"
使用API调用时在chrome上出现错误
net::ERR_CERT_AUTHORITY_INVALID
如何访问此接口?
发布于 2020-06-18 19:45:34
您是否拥有列出集群内命名空间的权限?例如,如果您以同一用户身份通过命令行界面登录,您可以运行kubectl get namespaces
吗?它看起来像是权限错误。对于集群中的所有名称空间,用户都需要IBM Cloud IAM Reader服务角色(为您提供RBAC view
角色)。
https://stackoverflow.com/questions/62425480
复制相似问题