kubernetes-dashboard.yaml 4.1 KB
Newer Older
C
Christoph Held 已提交
1
# Copyright 2017 The Kubernetes Authors.
2 3 4 5 6 7 8 9 10 11 12 13 14
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

C
Christoph Held 已提交
15

16
# Configuration to deploy release version of the Dashboard UI compatible with
M
Marcin Maciaszczyk 已提交
17
# Kubernetes 1.8.
18 19 20
#
# Example usage: kubectl create -f <this_file>

21 22
# ------------------- Dashboard Service Account ------------------- #

23
apiVersion: v1
24 25 26
kind: ServiceAccount
metadata:
  labels:
27 28
    k8s-app: kubernetes-dashboard
  name: kubernetes-dashboard
29
  namespace: kube-system
30

31
---
32 33 34
# ------------------- Dashboard Role & Role Binding ------------------- #

kind: Role
M
Marcin Maciaszczyk 已提交
35
apiVersion: rbac.authorization.k8s.io/v1
36
metadata:
37 38 39
  name: kubernetes-dashboard-minimal
  namespace: kube-system
rules:
M
Marcin Maciaszczyk 已提交
40
  # Allow Dashboard to create 'kubernetes-dashboard-key-holder' secret.
41 42
- apiGroups: [""]
  resources: ["secrets"]
M
Marcin Maciaszczyk 已提交
43
  verbs: ["create"]
44 45 46 47
  # Allow Dashboard to create 'kubernetes-dashboard-settings' config map.
- apiGroups: [""]
  resources: ["configmaps"]
  verbs: ["create"]
48
  # Allow Dashboard to get, update and delete Dashboard exclusive secrets.
49 50 51 52
- apiGroups: [""]
  resources: ["secrets"]
  resourceNames: ["kubernetes-dashboard-key-holder"]
  verbs: ["get", "update", "delete"]
53 54 55 56 57
  # Allow Dashboard to get and update 'kubernetes-dashboard-settings' config map.
- apiGroups: [""]
  resources: ["configmaps"]
  resourceNames: ["kubernetes-dashboard-settings"]
  verbs: ["get", "update"]
58 59 60 61 62
  # Allow Dashboard to get metrics from heapster.
- apiGroups: [""]
  resources: ["services"]
  resourceNames: ["heapster"]
  verbs: ["proxy"]
63 64 65 66
- apiGroups: [""]
  resources: ["services/proxy"]
  resourceNames: ["heapster", "http:heapster:", "https:heapster:"]
  verbs: ["get"]
67

68
---
M
Marcin Maciaszczyk 已提交
69
apiVersion: rbac.authorization.k8s.io/v1
70 71 72 73
kind: RoleBinding
metadata:
  name: kubernetes-dashboard-minimal
  namespace: kube-system
74 75
roleRef:
  apiGroup: rbac.authorization.k8s.io
76 77
  kind: Role
  name: kubernetes-dashboard-minimal
78 79
subjects:
- kind: ServiceAccount
80
  name: kubernetes-dashboard
81
  namespace: kube-system
82

83
---
84 85
# ------------------- Dashboard Deployment ------------------- #

86
kind: Deployment
M
Marcin Maciaszczyk 已提交
87
apiVersion: apps/v1beta2
88 89
metadata:
  labels:
90 91
    k8s-app: kubernetes-dashboard
  name: kubernetes-dashboard
92 93 94
  namespace: kube-system
spec:
  replicas: 1
95
  revisionHistoryLimit: 10
96 97
  selector:
    matchLabels:
98
      k8s-app: kubernetes-dashboard
99 100 101
  template:
    metadata:
      labels:
102
        k8s-app: kubernetes-dashboard
103 104
    spec:
      containers:
105
      - name: kubernetes-dashboard
106
        image: k8s.gcr.io/kubernetes-dashboard-amd64:v1.8.1
107 108 109 110 111 112 113 114
        ports:
        - containerPort: 9090
          protocol: TCP
        args:
          # Uncomment the following line to manually specify Kubernetes API server Host
          # If not specified, Dashboard will attempt to auto discover the API server and connect
          # to it. Uncomment only if the default does not work.
          # - --apiserver-host=http://my-address:port
115 116 117 118
        volumeMounts:
          # Create on-disk volume to store exec logs
        - mountPath: /tmp
          name: tmp-volume
119 120 121 122 123 124
        livenessProbe:
          httpGet:
            path: /
            port: 9090
          initialDelaySeconds: 30
          timeoutSeconds: 30
125 126 127
      volumes:
      - name: tmp-volume
        emptyDir: {}
128
      serviceAccountName: kubernetes-dashboard
129 130 131 132
      # Comment the following tolerations if Dashboard must not be deployed on master
      tolerations:
      - key: node-role.kubernetes.io/master
        effect: NoSchedule
133

134
---
135 136
# ------------------- Dashboard Service ------------------- #

137 138 139 140
kind: Service
apiVersion: v1
metadata:
  labels:
141 142
    k8s-app: kubernetes-dashboard
  name: kubernetes-dashboard
143 144 145
  namespace: kube-system
spec:
  ports:
146
  - port: 80
147 148
    targetPort: 9090
  selector:
149
    k8s-app: kubernetes-dashboard