Kubernetes 官方提供的仪表盘。
1. 下载 yaml 文件
wget https://raw.githubusercontent.com/kubernetes/dashboard/v2.7.0/aio/deploy/recommended.yaml
其中 v2.7.0 为 Kubernetes Dashboard 版本号,部署其他版本时替换此版本即可,可通过 GitHub 的 releases 页面( https://github.com/kubernetes/dashboard/releases )查看
2. 编辑 yaml 文件
vim recommended.yaml
修改 Service 部分,使用 NodePort 方式暴露 Dashboard 端口,确保集群外部可以访问,示例如下(此处使用 30000
端口暴露 Dashboard 服务):
kind: Service
apiVersion: v1
metadata:
labels:
k8s-app: kubernetes-dashboard
name: kubernetes-dashboard
namespace: kubernetes-dashboard
spec:
type: NodePort
ports:
- port: 443
targetPort: 8443
nodePort: 30000
selector:
k8s-app: kubernetes-dashboard
3. 部署 Dashboard
kubectl apply -f recommended.yaml
4. 查看是否部署成功
kubectl get pods -n kubernetes-dashboard
5. 访问 Kubernetes Dashboard
curl https://Kubernetes部署主机的IP:Dashboard监听端口号 --insecure
示例:
curl https://192.168.10.100:30000 --insecure
https
协议访问指定主机加端口即可https://Kubernetes部署主机的IP:Dashboard监听端口号
示例:
https://192.168.10.100:30000
1. 配置 RBAC
vim dashboard.admin-user.yml
apiVersion: v1
kind: ServiceAccount
metadata:
name: admin-user
namespace: kubernetes-dashboard
vim dashboard.admin-user-role.yml
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
kubectl apply -f dashboard.admin-user.yml -f dashboard.admin-user-role.yml
2. 生成令牌
kubectl create token admin-user -n kubernetes-dashboard
3. 使用生成的令牌登录 Kubernetes Dashboard
1. 进入【Settings】页面
2. 在 【Local settings】 中修改 【Language】
kubectl delete -f recommended.yaml -f dashboard.admin-user-role.yml -f dashboard.admin-user.yml
适用于 Kubernetes 多云、数据中心和边缘 管理的容器平台。
1. 下载相关 yaml 文件
下载地址: https://github.com/kubesphere/ks-installer/releases
wget https://github.com/kubesphere/ks-installer/releases/download/v3.4.1/kubesphere-installer.yaml
wget https://github.com/kubesphere/ks-installer/releases/download/v3.4.1/cluster-configuration.yaml
其中 v3.4.1 为 KubeSphere 版本号,部署其他版本时替换此版本即可,可通过 GitHub 的 releases 页面( https://github.com/kubesphere/ks-installer/releases )查看
2. 部署 KubeSphere
kubectl apply -f kubesphere-installer.yaml
kubectl apply -f cluster-configuration.yaml
3. 查看部署日志
kubectl logs -n kubesphere-system $(kubectl get pod -n kubesphere-system -l 'app in (ks-install, ks-installer)' -o jsonpath='{.items[0].metadata.name}') -f
4. 访问 KubeSphere
curl https://Kubernetes部署主机的IP:30880 --insecure
示例:
curl https://192.168.10.100:30880 --insecure
http
协议访问指定主机加端口即可http://Kubernetes部署主机的IP:30880
示例:
http://192.168.10.100:30880
1. 下载卸载脚本
下载地址: https://github.com/kubesphere/ks-installer/blob/v3.4.1/scripts/kubesphere-delete.sh
wget https://raw.githubusercontent.com/kubesphere/ks-installer/blob/v3.4.1/scripts/kubesphere-delete.sh
2. 卸载
/bin/bash kubesphere-delete.sh