Browse Source
Add kube dashboard, enabled by default (#1643)
Add kube dashboard, enabled by default (#1643)
* Add kube dashboard, enabled by default Also add rbac role for kube user * Update main.ymlpull/1627/head
Matthew Mosesohn
7 years ago
committed by
GitHub
6 changed files with 163 additions and 0 deletions
Unified View
Diff Options
-
12docs/getting-started.md
-
5inventory/group_vars/k8s-cluster.yml
-
11roles/kubernetes-apps/ansible/defaults/main.yml
-
20roles/kubernetes-apps/ansible/tasks/dashboard.yml
-
5roles/kubernetes-apps/ansible/tasks/main.yml
-
110roles/kubernetes-apps/ansible/templates/dashboard.yml.j2
@ -0,0 +1,20 @@ |
|||||
|
--- |
||||
|
- name: Kubernetes Apps | Lay down dashboard template |
||||
|
template: |
||||
|
src: "{{item.file}}" |
||||
|
dest: "{{kube_config_dir}}/{{item.file}}" |
||||
|
with_items: |
||||
|
- {file: dashboard.yml.j2, type: deploy, name: netchecker-agent} |
||||
|
register: manifests |
||||
|
when: inventory_hostname == groups['kube-master'][0] |
||||
|
|
||||
|
- name: Kubernetes Apps | Start dashboard |
||||
|
kube: |
||||
|
name: "{{item.item.name}}" |
||||
|
namespace: "{{system_namespace}}" |
||||
|
kubectl: "{{bin_dir}}/kubectl" |
||||
|
resource: "{{item.item.type}}" |
||||
|
filename: "{{kube_config_dir}}/{{item.item.file}}" |
||||
|
state: "latest" |
||||
|
with_items: "{{ manifests.results }}" |
||||
|
when: inventory_hostname == groups['kube-master'][0] |
@ -0,0 +1,110 @@ |
|||||
|
# Copyright 2015 Google Inc. All Rights Reserved. |
||||
|
# |
||||
|
# 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. |
||||
|
|
||||
|
# Configuration to deploy head version of the Dashboard UI compatible with |
||||
|
# Kubernetes 1.6 (RBAC enabled). |
||||
|
# |
||||
|
# Example usage: kubectl create -f <this_file> |
||||
|
|
||||
|
{% if rbac_enabled %} |
||||
|
apiVersion: v1 |
||||
|
kind: ServiceAccount |
||||
|
metadata: |
||||
|
labels: |
||||
|
k8s-app: kubernetes-dashboard |
||||
|
name: kubernetes-dashboard |
||||
|
namespace: {{ system_namespace }} |
||||
|
--- |
||||
|
apiVersion: rbac.authorization.k8s.io/v1beta1 |
||||
|
kind: ClusterRoleBinding |
||||
|
metadata: |
||||
|
name: kubernetes-dashboard |
||||
|
labels: |
||||
|
k8s-app: kubernetes-dashboard |
||||
|
roleRef: |
||||
|
apiGroup: rbac.authorization.k8s.io |
||||
|
kind: ClusterRole |
||||
|
name: cluster-admin |
||||
|
subjects: |
||||
|
- kind: ServiceAccount |
||||
|
name: kubernetes-dashboard |
||||
|
namespace: {{ system_namespace }} |
||||
|
{% endif %} |
||||
|
--- |
||||
|
kind: Deployment |
||||
|
apiVersion: extensions/v1beta1 |
||||
|
metadata: |
||||
|
labels: |
||||
|
k8s-app: kubernetes-dashboard |
||||
|
name: kubernetes-dashboard |
||||
|
namespace: {{ system_namespace }} |
||||
|
spec: |
||||
|
replicas: 1 |
||||
|
revisionHistoryLimit: 10 |
||||
|
selector: |
||||
|
matchLabels: |
||||
|
k8s-app: kubernetes-dashboard |
||||
|
template: |
||||
|
metadata: |
||||
|
labels: |
||||
|
k8s-app: kubernetes-dashboard |
||||
|
spec: |
||||
|
containers: |
||||
|
- name: kubernetes-dashboard |
||||
|
image: {{ dashboard_image_repo }}:{{ dashboard_image_tag }} |
||||
|
# Image is tagged and updated with :head, so always pull it. |
||||
|
imagePullPolicy: Always |
||||
|
resources: |
||||
|
limits: |
||||
|
cpu: {{ dashboard_cpu_limit }} |
||||
|
memory: {{ dashboard_memory_limit }} |
||||
|
requests: |
||||
|
cpu: {{ dashboard_cpu_requests }} |
||||
|
memory: {{ dashboard_memory_requests }} |
||||
|
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 |
||||
|
livenessProbe: |
||||
|
httpGet: |
||||
|
path: / |
||||
|
port: 9090 |
||||
|
initialDelaySeconds: 30 |
||||
|
timeoutSeconds: 30 |
||||
|
{% if rbac_enabled %} |
||||
|
serviceAccountName: kubernetes-dashboard |
||||
|
{% endif %} |
||||
|
# Comment the following tolerations if Dashboard must not be deployed on master |
||||
|
tolerations: |
||||
|
- key: node-role.kubernetes.io/master |
||||
|
effect: NoSchedule |
||||
|
--- |
||||
|
kind: Service |
||||
|
apiVersion: v1 |
||||
|
metadata: |
||||
|
labels: |
||||
|
k8s-app: kubernetes-dashboard |
||||
|
name: kubernetes-dashboard |
||||
|
namespace: {{ system_namespace }} |
||||
|
spec: |
||||
|
ports: |
||||
|
- port: 80 |
||||
|
targetPort: 9090 |
||||
|
selector: |
||||
|
k8s-app: kubernetes-dashboard |
||||
|
|
Write
Preview
Loading…
Cancel
Save