This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
система_kubernetes [2025/10/31 10:21] val [Kubernetes Dashboard] |
система_kubernetes [2025/10/31 14:49] (current) val [Kubernetes Dashboard] |
||
|---|---|---|---|
| Line 2134: | Line 2134: | ||
| name: admin-user | name: admin-user | ||
| namespace: kubernetes-dashboard | namespace: kubernetes-dashboard | ||
| + | #namespace: default | ||
| --- | --- | ||
| apiVersion: rbac.authorization.k8s.io/v1 | apiVersion: rbac.authorization.k8s.io/v1 | ||
| Line 2147: | Line 2148: | ||
| name: admin-user | name: admin-user | ||
| namespace: kubernetes-dashboard | namespace: kubernetes-dashboard | ||
| - | --- | + | #namespace: default |
| + | </code><code> | ||
| + | $ kubectl apply -f dashboard-user-role.yaml | ||
| + | |||
| + | $ kubectl create token admin-user -n kubernetes-dashboard #--duration=1h | ||
| + | |||
| + | $ ###ps aux | grep kube-apiserver | grep service-account-key-file | ||
| + | $ ###echo ... | jq -R 'split(".") | .[1] | @base64d | fromjson' | ||
| + | $ ###echo ... | awk -F'.' '{print $2}' | base64 -d | jq -r '.exp | todate' | ||
| + | |||
| + | cmder$ kubectl proxy | ||
| + | </code> | ||
| + | |||
| + | * http://localhost:8001/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:/proxy/ | ||
| + | |||
| + | <code> | ||
| + | $ cat dashboard-secret.yaml | ||
| + | </code><code> | ||
| apiVersion: v1 | apiVersion: v1 | ||
| kind: Secret | kind: Secret | ||
| Line 2153: | Line 2171: | ||
| name: admin-user | name: admin-user | ||
| namespace: kubernetes-dashboard | namespace: kubernetes-dashboard | ||
| + | #namespace: default | ||
| annotations: | annotations: | ||
| kubernetes.io/service-account.name: "admin-user" | kubernetes.io/service-account.name: "admin-user" | ||
| type: kubernetes.io/service-account-token | type: kubernetes.io/service-account-token | ||
| </code><code> | </code><code> | ||
| - | $ kubectl apply -f dashboard-user-role.yaml | + | $ kubectl apply -f dashboard-secret.yaml |
| - | + | ||
| - | $ kubectl -n kubernetes-dashboard create token admin-user #--duration=1h | + | |
| - | + | ||
| - | $ ###ps aux | grep kube-apiserver | grep service-account-key-file | + | |
| $ kubectl get secret admin-user -n kubernetes-dashboard -o jsonpath={".data.token"} | base64 -d ; echo | $ kubectl get secret admin-user -n kubernetes-dashboard -o jsonpath={".data.token"} | base64 -d ; echo | ||
| - | |||
| - | cmder$ kubectl proxy | ||
| </code> | </code> | ||
| - | |||
| - | * http://localhost:8001/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:/proxy/ | ||
| - | |||
| ===== Мониторинг ===== | ===== Мониторинг ===== | ||