部署UI
下载yaml文件
https://github.com/kubernetes/kubernetes
[[email protected] ~]# git clone https://github.com/kubernetes/kubernetes.git [[email protected] ~]# cd kubernetes/cluster/addons/dashboard/ [[email protected]-master1 dashboard]# ll total 32 -rw-r--r-- 1 root root 264 Dec 18 10:14 dashboard-configmap.yaml -rw-r--r-- 1 root root 1822 Dec 18 10:14 dashboard-controller.yaml -rw-r--r-- 1 root root 1353 Dec 18 10:14 dashboard-rbac.yaml -rw-r--r-- 1 root root 551 Dec 18 10:14 dashboard-secret.yaml -rw-r--r-- 1 root root 322 Dec 18 10:14 dashboard-service.yaml
基于yaml创建
kubectl create -f dashboard-rbac.yaml kubectl create -f dashboard-secret.yaml kubectl create -f dashboard-configmap.yaml kubectl create -f dashboard-controller.yaml kubectl create -f dashboard-service.yaml
查看
[[email protected] dashboard]# kubectl get pod,svc -n kube-system -o wide NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES pod/kubernetes-dashboard-77fdb66558-zmtm5 1/1 Running 0 7m47s 172.17.84.3 192.168.0.125 <none> <none> NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE SELECTOR service/kubernetes-dashboard NodePort 10.0.0.16 <none> 443:30001/TCP 7m37s k8s-app=kubernetes-dashboard
访问https://192.168.0.125:30001
获取令牌
[[email protected] dashboard]# kubectl -n kube-system get secret NAME TYPE DATA AGE dashboard-admin-token-pcrxx kubernetes.io/service-account-token 3 54s default-token-gqjhs kubernetes.io/service-account-token 3 19h kubernetes-dashboard-certs Opaque 29 10m kubernetes-dashboard-key-holder Opaque 2 28m kubernetes-dashboard-token-jg4vl kubernetes.io/service-account-token 3 27m [[email protected]-master1 dashboard]# kubectl -n kube-system describe secret dashboard-admin-token-pcrxx Name: dashboard-admin-token-pcrxx Namespace: kube-system Labels: <none> Annotations: kubernetes.io/service-account.name: dashboard-admin kubernetes.io/service-account.uid: 74d1b353-026f-11e9-a1f9-000c298a2b5f Type: kubernetes.io/service-account-token Data ==== ca.crt: 1359 bytes namespace: 11 bytes token: eyJhbGciOiJSUzI1NiIsImtpZCI6IiJ9.eyJpc3MiOiJrdWJlcm5ldGVzL3NlcnZpY2VhY2NvdW50Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9uYW1lc3BhY2UiOiJrdWJlLXN5c3RlbSIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VjcmV0Lm5hbWUiOiJkYXNoYm9hcmQtYWRtaW4tdG9rZW4tcGNyeHgiLCJrdWJlcm5ldGVzLmlvL3NlcnZpY2VhY2NvdW50L3NlcnZpY2UtYWNjb3VudC5uYW1lIjoiZGFzaGJvYXJkLWFkbWluIiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9zZXJ2aWNlLWFjY291bnQudWlkIjoiNzRkMWIzNTMtMDI2Zi0xMWU5LWExZjktMDAwYzI5OGEyYjVmIiwic3ViIjoic3lzdGVtOnNlcnZpY2VhY2NvdW50Omt1YmUtc3lzdGVtOmRhc2hib2FyZC1hZG1pbiJ9.CUNg1ehrzrGE-_z2ISmd2L8kKDGB4UHh1DB52TUoWjn1MLLqFVucZ4QBY_94R_Ck4uPB9vYUyNxAO7SZrIGke6VH-X3VNgfZG-2PWHP_gv6CyVWyxxdABbUeLRr2IjPTDfTC2sS8jwgVJflLHSDR-vbEqVCIqGnnHXpaQUv0t1kwAuXj23kyG6FajWKTdHLRCT-JV7dWlrmaYMfhlW1foCMrYoygXiqNMO20nlDryy4HO9PTL2v2pGJe7Rmbx8_G0BWGr-gMLzQD3VcsKB3dCDnqSLBHhfFDe7UDVcbpKiLL8H28w_VVFgw28tz-SgNyYXXg59r6TN-DB1unSlIJzQ
原文地址:https://www.cnblogs.com/yuezhimi/p/10135817.html
时间: 2024-10-08 04:21:35