# Rancher 一般使用者看不到 Metrics 頁面 ## 問題 下游叢集裝好 monitoring 工具後,一般使用者就算是這個 project 的 owener,在 workerload 也是看不到 Metrics 頁面。  ## 解決辦法 1. 在 local 叢集中執行以下指令,新增權限 ``` $ vim mon.yaml administrative: false apiVersion: management.cattle.io/v3 builtin: false clusterCreatorDefault: false context: project displayName: mon-test external: false hidden: false kind: RoleTemplate locked: false metadata: name: mon-test rules: - apiGroups: - monitoring.coreos.com resources: - '*' verbs: - list - get - watch - apiGroups: - '*' resources: - endpoints - jobs - cronjobs - daemonsets - deployments - replicasets - statefulsets - replicationcontrollers - services verbs: - list - get - watch - apiGroups: - '*' resourceNames: [] resources: - services/proxy verbs: - list - get - watch - create - apiGroups: - catalog.cattle.io resources: - apps verbs: - list - get - watch $ kubectl apply -f mon.yaml ``` 2. 進到下游叢集,指定一般使用者給 monitoring 工具所在的 project 新增權限  3. 一般使用者登入後,在 workerload 就可以看到 Metrics 頁面  ## 更細緻縮小權限 由於要看到工作負載的 metrics 資源,代表這個使用者也需要可以看的到 monitoring 的資源,可以參考以下做法再縮小這個權限。 1. 在 local 叢集將原本的權限刪除並套用以下權限 ``` administrative: false apiVersion: management.cattle.io/v3 builtin: false clusterCreatorDefault: false context: project displayName: mon-test external: false hidden: false kind: RoleTemplate locked: false metadata: name: mon-test rules: - apiGroups: - monitoring.coreos.com resources: - '*' verbs: - list - get - watch - apiGroups: - '*' resourceNames: [] resources: - services/proxy verbs: - list - get - watch - create - apiGroups: - catalog.cattle.io resources: - apps verbs: - list - get - watch ``` 2. 將 cattle-monitoring-system namespace 移動到一個獨立的 project,並在這個 project 新增權限。  3. 套用後,雖然使用者可以看到 monitoring 這個 project,但是並不會看到該 project 下的工作負載。並且該使用者也一樣可以看到自己所在的 namespace 下的工作負載 metrics。使用者也看不到整個集群的監控指標(rancher 2.7 以上的版本才會看不到)。 
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up