Hong Guan | 8ba5862 | 2018-02-22 10:54:22 -0500 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | |
| 3 | # ============LICENSE_START========================================== |
| 4 | # =================================================================== |
| 5 | # Copyright (c) 2017 AT&T |
| 6 | # |
| 7 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 8 | # you may not use this file except in compliance with the License. |
| 9 | # You may obtain a copy of the License at |
| 10 | # |
| 11 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 12 | # |
| 13 | # Unless required by applicable law or agreed to in writing, software |
| 14 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 15 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 16 | # See the License for the specific language governing permissions and |
| 17 | # limitations under the License. |
| 18 | #============LICENSE_END============================================ |
| 19 | |
| 20 | # this script will install dashboard on k8s master. |
| 21 | |
| 22 | #install heapster |
| 23 | git clone -b release-1.5 https://github.com/kubernetes/heapster.git |
| 24 | |
| 25 | kubectl create -f heapster/deploy/kube-config/influxdb/ |
| 26 | kubectl create -f heapster/deploy/kube-config/rbac/heapster-rbac.yaml |
| 27 | |
| 28 | #install dashboard |
| 29 | kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/master/src/deploy/alternative/kubernetes-dashboard.yaml |
| 30 | |
| 31 | ##Change spec.type from ClusterIP to NodePort and save. |
| 32 | kubectl get svc kubernetes-dashboard --namespace=kube-system -o yaml | sed 's/type: ClusterIP/type: NodePort/' | kubectl replace -f - |
| 33 | |
| 34 | cat <<EOF >>dashboard-admin.yaml |
| 35 | apiVersion: rbac.authorization.k8s.io/v1beta1 |
| 36 | kind: ClusterRoleBinding |
| 37 | metadata: |
| 38 | name: kubernetes-dashboard |
| 39 | labels: |
| 40 | k8s-app: kubernetes-dashboard |
| 41 | roleRef: |
| 42 | apiGroup: rbac.authorization.k8s.io |
| 43 | kind: ClusterRole |
| 44 | name: cluster-admin |
| 45 | subjects: |
| 46 | - kind: ServiceAccount |
| 47 | name: kubernetes-dashboard |
| 48 | namespace: kube-system |
| 49 | EOF |
| 50 | |
| 51 | kubectl create -f dashboard-admin.yaml |
| 52 | |
| 53 | #install helm |
| 54 | wget http://storage.googleapis.com/kubernetes-helm/helm-$1-linux-amd64.tar.gz |
| 55 | tar -zxvf helm-$1-linux-amd64.tar.gz |
| 56 | sudo mv linux-amd64/helm /usr/bin/helm |
| 57 | |
| 58 | kubectl -n kube-system create sa tiller |
| 59 | kubectl create clusterrolebinding tiller --clusterrole cluster-admin --serviceaccount=kube-system:tiller |
| 60 | helm init --service-account tiller |