我將使用哪種 RBAC 角色資源型別作為原始型別?
前任。kubectl get --raw "/api/v1/nodes/(your-node-name)/proxy/stats/summary"
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: k8s-ephemeral-storage-metrics-debug
rules:
- apiGroups: [""]
resources: ["*"]
verbs: ["*"]
還是去原始 API k8s 呼叫?
content, err := clientset.RESTClient().Get().AbsPath(fmt.Sprintf("/api/v1/nodes/%s/proxy/stats/summary", currentNode)).DoRaw(context.Background())
uj5u.com熱心網友回復:
API 檔案將此操作命名為“獲取連接代理路徑”,并將 URL 更具體地描述為
GET /api/v1/nodes/{name}/proxy/{path}
該.../proxy/...部分是有趣的部分。它表明您沒有對 Node 物件使用基本的 CRUD 操作,而是訪問 Node 的某些子資源。RBAC 設定具有特定的子資源語法。
您需要將 URL 分解為其組成部分您可以將其分解為幾個組成部分:
(no API group)
v
GET /api/v1/nodes/{name}/proxy/{path}
^^^^^ ^^^^^
resource subresource
然后resource/subresource在 RBAC 定義中使用該名稱
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: k8s-ephemeral-storage-metrics-debug
rules:
- apiGroups: [""]
resources: ["node/proxy"]
verbs: ["get"]
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/520344.html
標籤:去Kubernetes
下一篇:來自洪流公告的奇怪“同行”欄位
