본문 바로가기
Kubernetes/Monitoring

Dashboard on GCE

by 여행을 떠나자! 2021. 9. 15.

2020.04.10

1. Kubernetes dashboard install on Google K8s Engine

Ref. https://github.com/kubernetes/dashboard#kubernetes-dashboard

 $ kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.0.0-beta8/aio/deploy/recommended.yaml

 namespace/kubernetes-dashboard created

 serviceaccount/kubernetes-dashboard created

 service/kubernetes-dashboard created

 secret/kubernetes-dashboard-certs created

 secret/kubernetes-dashboard-csrf created

 secret/kubernetes-dashboard-key-holder created

 configmap/kubernetes-dashboard-settings created

 role.rbac.authorization.k8s.io/kubernetes-dashboard created

 clusterrole.rbac.authorization.k8s.io/kubernetes-dashboard created

 rolebinding.rbac.authorization.k8s.io/kubernetes-dashboard created

 clusterrolebinding.rbac.authorization.k8s.io/kubernetes-dashboard created

 deployment.apps/kubernetes-dashboard created

 service/dashboard-metrics-scraper created

 deployment.apps/dashboard-metrics-scraper created

 $

 $ vi kubernetes-dashboard-admin.yaml

 apiVersion: v1

 kind: ServiceAccount

 metadata:

   name: admin-user

   namespace: kubernetes-dashboard

 ---

 apiVersion: rbac.authorization.k8s.io/v1

 kind: ClusterRoleBinding

 metadata:

   name: admin-user

 roleRef:

   apiGroup: rbac.authorization.k8s.io

   kind: ClusterRole

   name: cluster-admin

 subjects:

 - kind: ServiceAccount

   name: admin-user

   namespace: kubernetes-dashboard

 $ k apply -f kubernetes-dashboard-admin.yaml

 serviceaccount/admin-user created

 clusterrolebinding.rbac.authorization.k8s.io/admin-user created

 $ kubectl -n kubernetes-dashboard describe secret $(kubectl -n kubernetes-dashboard get secret | grep admin-user | awk ‘{print $1}')

 Name:         admin-user-token-msvsj

 Namespace:    kubernetes-dashboard

 …

 Data

 ====

 ca.crt:     1119 bytes

 namespace:  20 bytes

 token:      eyJhbGciOiJSUzI1NiIsImtpZCI6IiJ9.eyJpc3MiOiJrdWJlcm5ldGVzL3NlcnZpY2VhY2NvdW50Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9uYW1l

c3BhY2UiOiJrdWJlcm5ldGVzLWRhc2hib2FyZCIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VjcmV0Lm5hbWUiOiJhZG1pbi11c2VyLXRva2VuLW1zdnNqIiwia3ViZ

XJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9zZXJ2aWNlLWFjY291bnQubmFtZSI6ImFkbWluLXVzZXIiLCJrdWJlcm5ldGVzLmlvL3NlcnZpY2VhY2NvdW50L3NlcnZpY2UtYWNjb3

VudC51aWQiOiIxNTI3OTM4NS02ZGUxLTExZWEtYTVkMS00MjAxMGE4ZTAxOTEiLCJzdWIiOiJzeXN0ZW06c2VydmljZWFjY291bnQ6a3ViZXJuZXRlcy1kYXNoYm9hcmQ6YWRtaW4

tdXNlciJ9.UbzPSyoNGcHFx0E2mxPA7vWqMU56dTjaBERTSMfWu0xvYNlITSYM7Bya6dtLxUvxpFDEE8Jylnqpu16tLgV-sC10kkTzprxjWdADpItskEwGzPYQDKcdTzNuHwF61Mv

wWuQ7unV1tdU5Ung8wSViZbbzw_U28tl8nC5l9AhC7BCpzjAsy1XkWERIWIy7HlsM8Q6JodOAC5lOANsR87uI190JiDhSXNGXqJ_XxL6jmocwxxI7SY5z4AkEpAT93eWhLGpVKfi8

LvcWoVYOV4ryzQoTGztVFqKwCUT8kSEl18QBykgic0WuwwVlnkRN-kX0n2rw0AhE4aHZrAYnC9jQEQ

 $

 

- 참고: Service를 LoadBalancer type으로 변경 - IN_USE_ADDRESSES 리소스 부족으로 변경 실패

 $ k edit service/kubernetes-dashboard -n kubernetes-dashboard

 :%s/ClusterIP/LoadBalancer/c

 kubectl edit service/kubernetes-dashboard -n kubernetes-dashboard

 service/kubernetes-dashboard edited

 $ k get service/kubernetes-dashboard -n kubernetes-dashboard

 NAME                   TYPE           CLUSTER-IP      EXTERNAL-IP   PORT(S)         AGE

 kubernetes-dashboard   LoadBalancer   10.63.243.173   <pending>     443:30243/TCP   6h6m

 Pending :

 Error creating load balancer (will retry): failed to ensure load balancer for service kubernetes-dashboard/kubernetes-dashboard: failed to create forwarding rule for  load balancer (a2fa7ac086db011eaa5d142010a8e019(kubernetes-dashboard/kubernetes-dashboard)): googleapi: Error 403: QUOTA_EXCEEDED - Quota 'IN_USE_ADDRESSES' exceeded. Limit: 4.0 globally.

 https://EXTERNAL-IP/

 $

 

 

2. Dashboard 호출 in MacOS

- Cloudshell에서 “k config view” 명령어 결과를 '~/.kube/config' 파일에 저장 

 $ vi ~/.kube/config

 apiVersion: v1

 clusters: 

 …

    server: https://34.73.250.144

 name: gke_my-kubeflow-271310_us-east1-b_my-kubeflow

 …

 $ kubectl proxy &

 

  URL : http://localhost:8001/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:/proxy/

- token 값을 입력 후  & “Sign in”

 $ kubectl -n kubernetes-dashboard describe secret $(kubectl -n kubernetes-dashboard get secret | grep admin-user | awk '{print $1}')

 

 

'Kubernetes > Monitoring' 카테고리의 다른 글

GPU Monitor  (0) 2021.09.21
Elastic Observability  (0) 2021.09.20
Elastic Observability - filebeat/metricbeat POD 오류  (0) 2021.09.15
Dashboard on bare-metal  (0) 2021.09.15
Metrics-server  (0) 2021.09.14

댓글