k8s入门系列之扩展组件(二)kube-ui安装篇

kube-ui是k8s提供的web管理界面,可以展示节点的内存、CPU、磁盘、Pod、RC、SVC等信息。

1.编辑kube-dashboard-rc.yml定义文件
[root@master kube-dashboard]# cat kubernetes-dashboard-rc.yml

复制代码
kind: 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/,效果如下图

posted @ 2020-03-09 16:31  dream_fly_info  阅读(326)  评论(0编辑  收藏  举报