k8s相关可视化界面
需要安装helm,自行安装哈
https://helm.sh/zh/docs/intro/install#from-script
dashboard
kubernetes-retired/dashboard: General-purpose web UI for Kubernetes clusters
已停更已停更已停更已停更已停更已停更已停更已停更已停更
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| tar_url="https://github.com/kubernetes-retired/dashboard/releases/download/kubernetes-dashboard-7.14.0/kubernetes-dashboard-7.14.0.tgz" tar_name=${tar_url##*/} dir_name=${tar_name%-*} wget $tar_url tar -zxf $tar_name cd $dir_name helm install kubernetes-dashboard . --namespace dashboard --create-namespace
kubectl patch svc -n dashboard kubernetes-dashboard-kong-proxy -p '{ "spec": { "type": "NodePort", "ports": [ { "port": 443, "targetPort": 8443, "nodePort": 30443 } ] } }'
|
提供token
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
|
sudo kubectl create serviceaccount dashboard-admin -n dashboard
sudo kubectl create clusterrolebinding dashboard-admin \ --clusterrole=cluster-admin \ --serviceaccount=dashboard:dashboard-admin
sudo kubectl create token dashboard-admin -n dashboard
sudo cat <<EOF | sudo kubectl apply -f - apiVersion: v1 kind: Secret metadata: name: dashboard-admin-token namespace: dashboard annotations: kubernetes.io/service-account.name: dashboard-admin type: kubernetes.io/service-account-token EOF TOKEN=$(sudo kubectl get secret dashboard-admin-token -n dashboard -o jsonpath='{.data.token}' | base64 --decode) echo $TOKEN
|
获取访问网页地址
1 2 3
| export NODE_PORT=$(kubectl get --namespace dashboard -o jsonpath="{.spec.ports[0].nodePort}" services kubernetes-dashboard-kong-proxy) export NODE_IP=$(kubectl get nodes --namespace dashboard -o jsonpath="{.items[0].status.addresses[0].address}") echo http://$NODE_IP:$NODE_PORT
|
然后你就把token填进去就行了
卸载可以用
1
| helm uninstall kubernetes-dashboard -n dashboard
|
headlamp
kubernetes-sigs/headlamp: A Kubernetes web UI that is fully-featured, user-friendly and extensible
1 2 3 4 5 6 7 8 9 10
| helm repo add headlamp https://headlamp-k8s.github.io/headlamp/ helm repo update headlamp helm install headlamp headlamp/headlamp \ --namespace headlamp \ --create-namespace \ --set service.type=NodePort \ --set service.nodePort=30001 \ --set service.port=80 \ --set service.targetPort=8080
|
提供token
headlamp有自己的sa(headlamp),不要乱改名字
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
| sudo kubectl create serviceaccount headlamp -n headlamp
sudo kubectl create clusterrolebinding headlamp \ --clusterrole=cluster-admin \ --serviceaccount=headlamp:headlamp
sudo kubectl create token headlamp -n headlamp
sudo cat <<EOF | sudo kubectl apply -f - apiVersion: v1 kind: Secret metadata: name: headlamp-token namespace: headlamp annotations: kubernetes.io/service-account.name: headlamp type: kubernetes.io/service-account-token EOF TOKEN=$(sudo kubectl get secret headlamp-token -n headlamp -o jsonpath='{.data.token}' | base64 --decode) echo $TOKEN
|
查看网页地址
1 2 3 4
| export NODE_PORT=$(kubectl get --namespace headlamp -o jsonpath="{.spec.ports[0].nodePort}" services headlamp) export NODE_IP=$(kubectl get nodes --namespace headlamp -o jsonpath="{.items[0].status.addresses[0].address}") echo http://$NODE_IP:$NODE_PORT
|
卸载可以用
1
| helm uninstall headlamp -n headlamp
|
千屹博客旗下的所有文章,是通过本人课堂学习和课外自学所精心整理的知识巨著
难免会有出错的地方
如果细心的你发现了小失误,可以在下方评论区告诉我,或者私信我!
非常感谢大家的热烈支持!