kube-ui是k8s提供的web管理界面,可以展示节点的内存、CPU、磁盘、Pod、RC、SVC等信息。
1.编辑kube-dashboard-rc.yml定义文件
[root@master kube-dashboard]# cat kubernetes-dashboard-rc.ymlkind: ReplicationController apiVersion: v1 metadata: labels: app: kubernetes-dashboard name: kubernetes-dashboard namespace: kube-system spec: replicas: 1 selector: app: kubernetes-dashboard template: metadata: labels: app: kubernetes-dashboard spec: containers: - name: kubernetes-dashboard image: docker.gaoxiaobang.com/kubernetes/kube-ui:v5 imagePullPolicy: Always ports: - containerPort: 8080
•创建Pod
[root@master kube-dashboard]# kubectl create -f kubernetes-dashboard-rc.yml
2.编辑kube-dashboard-svc.yml定义文件
[root@master kube-dashboard]# cat kubernetes-dashboard-svc.yml
kind: Service apiVersion: v1 metadata: labels: app: kubernetes-dashboard name: kubernetes-dashboard namespace: kube-system spec: type: NodePort ports: - port: 80 targetPort: 8080 selector: app: kubernetes-dashboard
•创建Service
[root@master kube-dashboard]# kubectl create -f kubernetes-dashboard-svc.yml
3.访问192.168.30.20:8080/ui(也就是master节点),会自动跳转到http://192.168.30.20:8080/api/v1/proxy/namespaces/kube-system/services/kubernetes-dashboard/#/dashboard/,效果如下图