|
| 1 | +# Copyright 2017 The Kubernetes Authors. |
| 2 | +# |
| 3 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +# you may not use this file except in compliance with the License. |
| 5 | +# You may obtain a copy of the License at |
| 6 | +# |
| 7 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +# |
| 9 | +# Unless required by applicable law or agreed to in writing, software |
| 10 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +# See the License for the specific language governing permissions and |
| 13 | +# limitations under the License. |
| 14 | + |
| 15 | +# ------------------- Dashboard Secret ------------------- # |
| 16 | + |
| 17 | +apiVersion: v1 |
| 18 | +kind: Secret |
| 19 | +metadata: |
| 20 | + labels: |
| 21 | + k8s-app: kubernetes-dashboard |
| 22 | + name: kubernetes-dashboard-certs |
| 23 | + namespace: kube-system |
| 24 | +type: Opaque |
| 25 | + |
| 26 | +--- |
| 27 | +# ------------------- Dashboard Service Account ------------------- # |
| 28 | + |
| 29 | +apiVersion: v1 |
| 30 | +kind: ServiceAccount |
| 31 | +metadata: |
| 32 | + labels: |
| 33 | + k8s-app: kubernetes-dashboard |
| 34 | + name: kubernetes-dashboard |
| 35 | + namespace: kube-system |
| 36 | + |
| 37 | +--- |
| 38 | +# ------------------- Dashboard Role & Role Binding ------------------- # |
| 39 | + |
| 40 | +kind: Role |
| 41 | +apiVersion: rbac.authorization.k8s.io/v1 |
| 42 | +metadata: |
| 43 | + name: kubernetes-dashboard-minimal |
| 44 | + namespace: kube-system |
| 45 | +rules: |
| 46 | + # Allow Dashboard to create 'kubernetes-dashboard-key-holder' secret. |
| 47 | +- apiGroups: [""] |
| 48 | + resources: ["secrets"] |
| 49 | + verbs: ["create"] |
| 50 | + # Allow Dashboard to create 'kubernetes-dashboard-settings' config map. |
| 51 | +- apiGroups: [""] |
| 52 | + resources: ["configmaps"] |
| 53 | + verbs: ["create"] |
| 54 | + # Allow Dashboard to get, update and delete Dashboard exclusive secrets. |
| 55 | +- apiGroups: [""] |
| 56 | + resources: ["secrets"] |
| 57 | + resourceNames: ["kubernetes-dashboard-key-holder", "kubernetes-dashboard-certs"] |
| 58 | + verbs: ["get", "update", "delete"] |
| 59 | + # Allow Dashboard to get and update 'kubernetes-dashboard-settings' config map. |
| 60 | +- apiGroups: [""] |
| 61 | + resources: ["configmaps"] |
| 62 | + resourceNames: ["kubernetes-dashboard-settings"] |
| 63 | + verbs: ["get", "update"] |
| 64 | + # Allow Dashboard to get metrics from heapster. |
| 65 | +- apiGroups: [""] |
| 66 | + resources: ["services"] |
| 67 | + resourceNames: ["heapster"] |
| 68 | + verbs: ["proxy"] |
| 69 | +- apiGroups: [""] |
| 70 | + resources: ["services/proxy"] |
| 71 | + resourceNames: ["heapster", "http:heapster:", "https:heapster:"] |
| 72 | + verbs: ["get"] |
| 73 | + |
| 74 | +--- |
| 75 | +apiVersion: rbac.authorization.k8s.io/v1 |
| 76 | +kind: RoleBinding |
| 77 | +metadata: |
| 78 | + name: kubernetes-dashboard-minimal |
| 79 | + namespace: kube-system |
| 80 | +roleRef: |
| 81 | + apiGroup: rbac.authorization.k8s.io |
| 82 | + kind: Role |
| 83 | + name: kubernetes-dashboard-minimal |
| 84 | +subjects: |
| 85 | +- kind: ServiceAccount |
| 86 | + name: kubernetes-dashboard |
| 87 | + namespace: kube-system |
| 88 | + |
| 89 | +--- |
| 90 | +# ------------------- Dashboard Deployment ------------------- # |
| 91 | + |
| 92 | +kind: Deployment |
| 93 | +apiVersion: apps/v1beta2 |
| 94 | +metadata: |
| 95 | + labels: |
| 96 | + k8s-app: kubernetes-dashboard |
| 97 | + name: kubernetes-dashboard |
| 98 | + namespace: kube-system |
| 99 | +spec: |
| 100 | + replicas: 1 |
| 101 | + revisionHistoryLimit: 10 |
| 102 | + selector: |
| 103 | + matchLabels: |
| 104 | + k8s-app: kubernetes-dashboard |
| 105 | + template: |
| 106 | + metadata: |
| 107 | + labels: |
| 108 | + k8s-app: kubernetes-dashboard |
| 109 | + spec: |
| 110 | + containers: |
| 111 | + - name: kubernetes-dashboard |
| 112 | + image: k8s.gcr.io/kubernetes-dashboard-amd64:v1.10.0 |
| 113 | + ports: |
| 114 | + - containerPort: 8443 |
| 115 | + protocol: TCP |
| 116 | + args: |
| 117 | + - --auto-generate-certificates |
| 118 | + - --token-ttl=5400 |
| 119 | + # Uncomment the following line to manually specify Kubernetes API server Host |
| 120 | + # If not specified, Dashboard will attempt to auto discover the API server and connect |
| 121 | + # to it. Uncomment only if the default does not work. |
| 122 | + # - --apiserver-host=http://my-address:port |
| 123 | + volumeMounts: |
| 124 | + - name: kubernetes-dashboard-certs |
| 125 | + mountPath: /certs |
| 126 | + # Create on-disk volume to store exec logs |
| 127 | + - mountPath: /tmp |
| 128 | + name: tmp-volume |
| 129 | + livenessProbe: |
| 130 | + httpGet: |
| 131 | + scheme: HTTPS |
| 132 | + path: / |
| 133 | + port: 8443 |
| 134 | + initialDelaySeconds: 30 |
| 135 | + timeoutSeconds: 30 |
| 136 | + volumes: |
| 137 | + - name: kubernetes-dashboard-certs |
| 138 | + hostPath: |
| 139 | + path: /home/share/certs |
| 140 | + type: Directory |
| 141 | + - name: tmp-volume |
| 142 | + emptyDir: {} |
| 143 | + serviceAccountName: kubernetes-dashboard |
| 144 | + # Comment the following tolerations if Dashboard must not be deployed on master |
| 145 | + tolerations: |
| 146 | + - key: node-role.kubernetes.io/master |
| 147 | + effect: NoSchedule |
| 148 | + |
| 149 | +--- |
| 150 | +# ------------------- Dashboard Service ------------------- # |
| 151 | + |
| 152 | +kind: Service |
| 153 | +apiVersion: v1 |
| 154 | +metadata: |
| 155 | + labels: |
| 156 | + k8s-app: kubernetes-dashboard |
| 157 | + name: kubernetes-dashboard |
| 158 | + namespace: kube-system |
| 159 | +spec: |
| 160 | + ports: |
| 161 | + - port: 443 |
| 162 | + targetPort: 8443 |
| 163 | + nodePort: 31234 |
| 164 | + selector: |
| 165 | + k8s-app: kubernetes-dashboard |
| 166 | + type: NodePort |
0 commit comments