更新集成其他k8s组件的离线安装

pull/254/head
gjmzj 2018-06-28 10:52:20 +08:00
parent de47026ef6
commit 7699870ba4
5 changed files with 88 additions and 11 deletions

1
.gitignore vendored
View File

@ -1,5 +1,6 @@
down/*
!down/download.sh
!down/offline_images
bin/*
hosts
*.crt

View File

@ -0,0 +1,39 @@
###---[basic_images ]
# dns-addon 插件
coredns/coredns:1.0.6
mirrorgooglecontainers/k8s-dns-kube-dns-amd64:1.14.10
mirrorgooglecontainers/k8s-dns-dnsmasq-nanny-amd64:1.14.10
mirrorgooglecontainers/k8s-dns-sidecar-amd64:1.14.10
# metrics-server 插件
mirrorgooglecontainers/metrics-server-amd64:v0.2.1
# calico 网络插件
calico/node:v3.0.6
calico/cni:v2.0.5
calico/kube-controllers:v2.0.4
# flannel 网络插件
jmgao1983/flannel:v0.10.0-amd64
# kube-router 网络插件
cloudnativelabs/kube-router
busybox
# dashboard 插件
mirrorgooglecontainers/kubernetes-dashboard-amd64:v1.8.3
# pause 基础容器镜像
mirrorgooglecontainers/pause-amd64:3.1
# traefik ingress 镜像
traefik:v1.6
# heapster 插件
mirrorgooglecontainers/heapster-grafana-amd64:v4.4.3
mirrorgooglecontainers/heapster-amd64:v1.5.1
mirrorgooglecontainers/heapster-influxdb-amd64:v1.3.3
###---[extra-images]
# helm 服务端
jmgao1983/tiller:v2.9.1
# efk 插件
mirrorgooglecontainers/elasticsearch:v5.6.4
alpine:3.6
mirrorgooglecontainers/fluentd-elasticsearch:v2.0.2
jmgao1983/kibana:5.6.4
# nfs 动态PV
jmgao1983/nfs-client-provisioner:latest

View File

@ -1,15 +1,21 @@
# dns 自动安装,可选"coredns"和“kubedns”
dns_install: "yes"
dns_backend: "coredns"
kubedns_offline: "kubedns_1.14.10.tar"
coredns_offline: "coredns_1.0.6.tar"
# metric server 自动安装
metricsserver_install: "yes"
metricsserver_offline: "metrics-server_v0.2.1.tar"
# dashboard 自动安装
dashboard_install: "yes"
dashboard_offline: "dashboard_v1.8.3.tar"
# traefik-ingress 自动安装
ingress_install: "no"
ingress_backend: "traefik"
traefik_offline: "traefik_v1.6.tar"
# heapster 自动安装
heapster_install: "no"

View File

@ -10,28 +10,53 @@
command: "{{ bin_dir }}/kubectl get pod -n kube-system"
register: pod_info
- name: 创建 {{ dns_backend }}部署
shell: "sleep 5; {{ bin_dir }}/kubectl apply -f {{ base_dir }}/manifests/{{ dns_backend }}"
when: 'dns_backend not in pod_info.stdout and dns_install == "yes"'
- block:
- name: 尝试推送离线{{ dns_backend }}镜像(若执行失败,可忽略)
copy: src={{ base_dir }}/down/{{ dns_offline }} dest=/opt/kube/images/{{ dns_offline }}
- name: 导入{{ dns_backend }}的离线镜像(若执行失败,可忽略)
shell: "{{ bin_dir }}/docker load -i /opt/kube/images/{{ dns_offline }}"
- name: 创建{{ dns_backend }}部署
shell: "sleep 5; {{ bin_dir }}/kubectl apply -f {{ base_dir }}/manifests/{{ dns_backend }}"
when: '"kube-dns" not in pod_info.stdout and "coredns" not in pod_info.stdout and dns_install == "yes"'
ignore_errors: true
- name: 创建 metrics-server部署
shell: "sleep 5; {{ bin_dir }}/kubectl apply -f {{ base_dir }}/manifests/metrics-server"
- block:
- name: 尝试推送离线 metrics-server镜像若执行失败可忽略
copy: src={{ base_dir }}/down/{{ metricsserver_offline }} dest=/opt/kube/images/{{ metricsserver_offline }}
- name: 导入 metrics-server的离线镜像若执行失败可忽略
shell: "{{ bin_dir }}/docker load -i /opt/kube/images/{{ metricsserver_offline }}"
- name: 创建 metrics-server部署
shell: "sleep 5; {{ bin_dir }}/kubectl apply -f {{ base_dir }}/manifests/metrics-server"
when: '"metrics-server" not in pod_info.stdout and metricsserver_install == "yes"'
ignore_errors: true
- name: 创建 dashboard部署
shell: "sleep 5; {{ bin_dir }}/kubectl apply -f {{ base_dir }}/manifests/dashboard"
- block:
- name: 尝试推送离线 dashboard镜像若执行失败可忽略
copy: src={{ base_dir }}/down/{{ dashboard_offline }} dest=/opt/kube/images/{{ dashboard_offline }}
- name: 导入 dashboard的离线镜像若执行失败可忽略
shell: "{{ bin_dir }}/docker load -i /opt/kube/images/{{ dashboard_offline }}"
- name: 创建 dashboard部署
shell: "sleep 5; {{ bin_dir }}/kubectl apply -f {{ base_dir }}/manifests/dashboard"
when: '"kubernetes-dashboard" not in pod_info.stdout and dashboard_install == "yes"'
ignore_errors: true
- name: 创建 traefik-ingress部署
shell: "sleep 5; {{ bin_dir }}/kubectl apply -f {{ base_dir }}/manifests/ingress/traefik-ingress.yaml"
- block:
- name: 尝试推送离线 traefik镜像若执行失败可忽略
copy: src={{ base_dir }}/down/{{ traefik_offline }} dest=/opt/kube/images/{{ traefik_offline }}
- name: 导入 traefik的离线镜像若执行失败可忽略
shell: "{{ bin_dir }}/docker load -i /opt/kube/images/{{ traefik_offline }}"
- name: 创建 traefik部署
shell: "sleep 5; {{ bin_dir }}/kubectl apply -f {{ base_dir }}/manifests/ingress/traefik-ingress.yaml"
when: '"traefik-ingress-controller" not in pod_info.stdout and ingress_install == "yes"'
ignore_errors: true
- name: 创建 heapster部署
shell: "sleep 5; {{ bin_dir }}/kubectl apply -f {{ base_dir }}/manifests/heapster"
- block:
- name: 尝试推送离线 heapster镜像若执行失败可忽略
copy: src={{ base_dir }}/down/{{ heapster_offline }} dest=/opt/kube/images/{{ heapster_offline }}
- name: 导入 heapster的离线镜像若执行失败可忽略
shell: "{{ bin_dir }}/docker load -i /opt/kube/images/{{ heapster_offline }}"
- name: 创建 heapster部署
shell: "sleep 5; {{ bin_dir }}/kubectl apply -f {{ base_dir }}/manifests/heapster"
when: '"heapster" not in pod_info.stdout and heapster_install == "yes"'
ignore_errors: true

View File

@ -0,0 +1,6 @@
dns_offline: "{%- if dns_backend == 'coredns' -%} \
{{ coredns_offline }} \
{%- else -%} \
{{ kubedns_offline }} \
{%- endif -%}"