一、实验准备
1、文件结构与组成
[root@master dashboard]# ll total 8 -rw-r--r-- 1 root root 1014 May 13 11:59 dashboard-deploy.yaml -rw-r--r-- 1 root root 274 May 13 11:43 dashboard-svc.yaml
2、具体内容
dashboard-deploy.yaml
[root@master dashboard]# cat dashboard-deploy.yaml apiVersion: extensions/v1beta1 kind: Deployment metadata: # Keep the name in sync with image version and # gce/coreos/kube-manifests/addons/dashboard counterparts name: kubernetes-dashboard-latest namespace: kube-system spec: replicas: 1 template: metadata: labels: k8s-app: kubernetes-dashboard version: latest kubernetes.io/cluster-service: "true" spec: containers: - name: kubernetes-dashboard image: 192.168.118.18:5000/kubernetes-dashboard-amd64:v1.4.1 resources: # keep request = limit to keep this container in guaranteed class limits: cpu: 100m memory: 50Mi requests: cpu: 100m memory: 50Mi ports: - containerPort: 9090 args: - --apiserver-host=http://192.168.118.18:8080 livenessProbe: httpGet: path: / port: 9090 initialDelaySeconds: 30 timeoutSeconds: 30
dashboard-svc.yaml
[root@master dashboard]# cat dashboard-svc.yaml apiVersion: v1 kind: Service metadata: name: kubernetes-dashboard namespace: kube-system labels: k8s-app: kubernetes-dashboard kubernetes.io/cluster-service: "true" spec: selector: k8s-app: kubernetes-dashboard ports: - port: 80 targetPort: 9090
镜像仓库
[root@master dashboard]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE 192.168.118.18:5000/kubernetes-dashboard-amd64 v1.4.1 1dda73f463b2 3 years ago 86.8 MB
二、操作演示过程
安装部署
[root@k8s-master dashboard]# kubectl create -f dashboard-deploy.yaml deployment "kubernetes-dashboard-latest" created [root@k8s-master dashboard]# kubectl create -f dashboard-svc.yaml service “kubernetes-dashboard” created
检查
[root@k8s-master dashboard]# kubectl get pod --namespace=kube-system NAME READY STATUS RESTARTS AGE kube-dns-453684471-gxhwn 4/4 Running 16 23h kubernetes-dashboard-latest-1012954252-8gvcp 1/1 Running 0 4m