kubernetes学习记录(8)——中文界面版dashboard安装

dashboard-controller.yaml

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: kubernetes-dashboard
  namespace: kube-system
  labels:
    k8s-app: kubernetes-dashboard
    kubernetes.io/cluster-service: "true"
spec:
  selector:
    matchLabels:
      k8s-app: kubernetes-dashboard
  template:
    metadata:
      labels:
        k8s-app: kubernetes-dashboard
      annotations:
        scheduler.alpha.kubernetes.io/critical-pod: ''
        scheduler.alpha.kubernetes.io/tolerations: '[{"key":"CriticalAddonsOnly", "operator":"Exists"}]'
    spec:
      containers:
      - name: kubernetes-dashboard
        image: bestwu/kubernetes-dashboard-amd64:v1.6.3
        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.121.143:8080
        livenessProbe:
          httpGet:
            path: /
            port: 9090
          initialDelaySeconds: 30
          timeoutSeconds: 30

这里dashboard镜像我是从本地Docker库里获取的。
推荐可以使用以下指令下载。
docker pull docker.io/mritd/kubernetes-dashboard-amd64:v1.5.0
docker pull gcr.io/google_containers/kubernetes-dashboard-amd64:v1.6.3
或者
docker pull bestwu/kubernetes-dashboard-amd64:v1.6.3
有关镜像的导入导出可以参考我的博客Docker学习记录(1)——搭建自己的Docker Registry
(1.6.3版本是中文界面)
dashboard-service.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
kubectl create -f dashboard-controller.yaml
kubectl create -f dashboard-service.yaml

kubernetes学习记录(8)——中文界面版dashboard安装_第1张图片
在浏览器输入http://192.168.121.143:8080/ui即可访问。
192.168.121.143是我的Master服务器地址。
kubernetes学习记录(8)——中文界面版dashboard安装_第2张图片
之前在创建覆盖网络时,没有在Master上安装flannel,导致无法直接通过Master地址访问dashboard

折线图等是装完headster之后才有

也可以在dashboard-service.yaml中,通过设置nodePort映射到物理机,同时设置Service的类型为NodePort,然后通过dashboard所在的node节点IP加NodePort访问。集群外部访问Pod或Service可以参考http://blog.csdn.net/huqigang/article/details/76428017

你可能感兴趣的:(Kubernetes,从零学习云计算)