在尝试访问 httpd pod 的网络时继续获取此信息,我缺少什么权限。
{
"kind": "Status",
"apiVersion": "v1",
"metadata": {
},
"status": "Failure",
"message": "pods \"pod-httpd\" is forbidden: User \"system:anonymous\" cannot get resource \"pods\" in API group \"\" in the namespace \"default\"",
"reason": "Forbidden",
"details": {
"name": "pod-httpd",
"kind": "pods"
},
"code": 403
}
答案 0 :(得分:1)
错误很明显 User "system:anonymous"
意味着 k8s 将您识别为 anonymous
用户,这就是为什么它给出了访问所需资源的禁止理由。
因此,当您执行 curl https://<ip>:<port>/<endpoint>
时,您正在使用 TLS 进行通信。在这种类型的通信中,您需要提供您的 CA(证书颁发机构,谁签署了您的证书)证书,以及您的证书和 curl 密钥,如下所示,因为在 TLS 服务器-客户端中需要进行验证。
curl https://<ip>:<port>/<endpoint> --key <your_key> --cert <your_cert> --cacert <ca_cert>
注意:这里的you
是指客户