修改安装dashboard同时安装heapster

pull/492/head
gjmzj 2019-03-22 16:11:41 +08:00
parent e979b93fd9
commit a076a384ad
3 changed files with 78 additions and 2 deletions

View File

@ -0,0 +1,74 @@
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: heapster
namespace: kube-system
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: heapster
subjects:
- kind: ServiceAccount
name: heapster
namespace: kube-system
roleRef:
kind: ClusterRole
name: system:heapster
apiGroup: rbac.authorization.k8s.io
---
apiVersion: apps/v1beta1
kind: Deployment
metadata:
name: heapster
namespace: kube-system
spec:
replicas: 1
selector:
matchLabels:
k8s-app: heapster
template:
metadata:
labels:
task: monitoring
k8s-app: heapster
spec:
serviceAccountName: heapster
containers:
- name: heapster
#image: gcr.io/google_containers/heapster-amd64:v1.5.4
image: mirrorgooglecontainers/heapster-amd64:v1.5.4
imagePullPolicy: IfNotPresent
command:
- /heapster
#- --source=kubernetes:https://kubernetes.default
- --source=kubernetes.summary_api:''
#- --sink=influxdb:http://monitoring-influxdb.kube-system.svc:8086
livenessProbe:
httpGet:
path: /healthz
port: 8082
scheme: HTTP
initialDelaySeconds: 180
timeoutSeconds: 5
---
apiVersion: v1
kind: Service
metadata:
labels:
task: monitoring
# For use as a Cluster add-on (https://github.com/kubernetes/kubernetes/tree/master/cluster/addons)
# If you are NOT using this as an addon, you should comment out this line.
#kubernetes.io/cluster-service: 'true'
kubernetes.io/name: Heapster
name: heapster
namespace: kube-system
spec:
ports:
- port: 80
targetPort: 8082
selector:
k8s-app: heapster

View File

@ -15,7 +15,7 @@ metricsserver_offline: "metrics-server_v0.3.1.tar"
# dashboard 自动安装
dashboard_install: "yes"
dashboard_offline: "dashboard_v1.10.0.tar"
dashboard_offline: "dashboard_v1.10.1.tar"
# ingress 自动安装,可选 "traefik" 和 "nginx-ingress"
ingress_install: "no"

View File

@ -67,6 +67,7 @@
when: '"metrics-server" not in pod_info.stdout and metricsserver_install == "yes"'
ignore_errors: true
# 现阶段 dashboard 获取metrics仍旧依赖于heapster因此需连带安装heapster
- block:
- name: 尝试推送离线 dashboard镜像若执行失败可忽略
copy: src={{ base_dir }}/down/{{ dashboard_offline }} dest=/opt/kube/images/{{ dashboard_offline }}
@ -81,7 +82,8 @@
when: 'dashboard_offline in image_info.stdout'
- name: 创建 dashboard部署
shell: "{{ bin_dir }}/kubectl apply -f {{ base_dir }}/manifests/dashboard"
shell: "{{ bin_dir }}/kubectl apply -f {{ base_dir }}/manifests/dashboard && \
{{ bin_dir }}/kubectl apply -f {{ base_dir }}/manifests/heapster/heapster-only"
delegate_to: "{{ groups.deploy[0] }}"
run_once: true
when: '"kubernetes-dashboard" not in pod_info.stdout and dashboard_install == "yes"'