$ kubectl get all -n kube-system -l k8s-app=kubernetes-dashboard NAME READY STATUS RESTARTS AGE pod/kubernetes-dashboard-5f7b999d65-sswt4 1/1 Running 0 84m
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE service/kubernetes-dashboard ClusterIP 10.102.216.229 <none> 443/TCP 84m
NAME READY UP-TO-DATE AVAILABLE AGE deployment.apps/kubernetes-dashboard 1/1 1 1 84m
NAME DESIRED CURRENT READY AGE replicaset.apps/kubernetes-dashboard-5f7b999d65 1 1 1 84m
Data ==== ca.crt: 1025 bytes namespace: 11 bytes token: eyJhbGciOiJSUzI1NiIsImtpZCI6IiJ9.eyJpc3MiOiJrdWJlcm5ldGVzL3NlcnZpY2VhY2NvdW50Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9uYW1lc3BhY2UiOiJrdWJlLXN5c3RlbSIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VjcmV0Lm5hbWUiOiJhZG1pbi11c2VyLXRva2VuLWN0cjlzIiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9zZXJ2aWNlLWFjY291bnQubmFtZSI6ImFkbWluLXVzZXIiLCJrdWJlcm5ldGVzLmlvL3NlcnZpY2VhY2NvdW50L3NlcnZpY2UtYWNjb3VudC51aWQiOiJiMmE0MTFkOS02NGM5LTExZTktYTU5ZC0xYzg3MmM0MzYwN2YiLCJzdWIiOiJzeXN0ZW06c2VydmljZWFjY291bnQ6a3ViZS1zeXN0ZW06YWRtaW4tdXNlciJ9.wA-CiA6yqJnxDJgQEX0pes32RGm9I_eh0fOoT6oEuLN849FhuNHPJ-LquEm9TFOVs944NXner_fq8czncrQUSiCmErH5ms6mSmXT8Ql-PjDWUCSpwb6rrDd8GCFSLA4LYZbgNQMiD21q2KY8HN3djW0QK1kcl3Cc19lyeAYMQ6DL6WU1AWzlsZEzAkd_P6r8a6KXrDxZNRimIzl61yioVmLqPGN3imT0u3DUvedbDReWVSTBYvOEExvgchgKKuImr0i1V2m7GbfJ01kDwKcehh78YPPMtXG-wfwVLA9xancHtoP0exPQ15fx9fQvswEoH1Qwz5T4dA2TYXKzHweZvg
最後登入的時,使用 Token 登入,將 Token 複製貼上就能夠登入了。
Trouble Shooting
Address already in use
如果你是背景執行 proxy 指令的話:
1
kubectl proxy &
在這個時候,沒有關掉這個程式,直接關掉終端機,再次執行則會發現 port 已經被佔用了,顯示的錯誤如下:
1
F0422 16:14:59.688258 15922 proxy.go:158] listen tcp 127.0.0.1:8001: bind: address already in use
方法一
如果你執行 proxy 的終端機還開著,可以使用 fg 指令把程式叫回,在按 Ctrl-C 即可:
方法二
萬一你把執行 proxy 的終端機關閉了,則必須先找到執行 proxy 的執行緒 pid:
1 2 3 4 5 6 7 8
$ netstat -tulp | grep kubectl (Not all processes could be identified, non-owned process info will not be shown, you would have to be root to see it all.) tcp 0 0 localhost:8001 0.0.0.0:* LISTEN 15908/kubectl # 或是 $ ps -ef | grep kubectl akiicat 15908 7633 0 16:14 pts/1 00:00:00 kubectl proxy akiicat 20117 7633 0 16:23 pts/1 00:00:00 grep --color=auto kubectl