增加等待网络插件正常运行

pull/243/merge
gjmzj 2018-06-18 00:04:00 +08:00
parent 1b1e3a11fa
commit 6f201476bd
5 changed files with 32 additions and 7 deletions

View File

@ -53,3 +53,12 @@
- name: 准备 calicoctl配置文件
template: src=calicoctl.cfg.j2 dest=/etc/calico/calicoctl.cfg
# 等待网络插件部署成功,视下载镜像速度而定
- name: 轮询等待calico-node 运行,视下载镜像速度而定
shell: "{{ bin_dir }}/kubectl get pod -n kube-system -o wide|grep 'calico-node'|grep ' {{ inventory_hostname }} '|awk '{print $3}'"
register: pod_status
until: pod_status.stdout == "Running"
retries: 12
delay: 8

View File

@ -11,18 +11,18 @@
register: pod_info
- name: 创建 {{ dns_backend }}部署
shell: "{{ bin_dir }}/kubectl apply -f {{ base_dir }}/manifests/{{ 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"'
- name: 创建 metrics-server部署
shell: "{{ bin_dir }}/kubectl apply -f {{ base_dir }}/manifests/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"'
- name: 创建 dashboard部署
shell: "{{ bin_dir }}/kubectl apply -f {{ base_dir }}/manifests/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"'
- name: 创建 heapster部署
shell: "{{ bin_dir }}/kubectl apply -f {{ base_dir }}/manifests/heapster"
shell: "sleep 5; {{ bin_dir }}/kubectl apply -f {{ base_dir }}/manifests/heapster"
when: '"heapster" not in pod_info.stdout and heapster_install == "yes"'

View File

@ -31,3 +31,11 @@
- name: 删除默认cni配置
file: path=/etc/cni/net.d/10-default.conf state=absent
# 等待网络插件部署成功,视下载镜像速度而定
- name: 轮询等待flannel 运行,视下载镜像速度而定
shell: "{{ bin_dir }}/kubectl get pod -n kube-system -o wide|grep 'flannel'|grep ' {{ inventory_hostname }} '|awk '{print $3}'"
register: pod_status
until: pod_status.stdout == "Running"
retries: 12
delay: 8

View File

@ -89,8 +89,8 @@
shell: "{{ bin_dir }}/kubectl get node {{ inventory_hostname }}|awk 'NR>1{print $2}'"
register: node_status
until: node_status.stdout == "Ready" or node_status.stdout == "Ready,SchedulingDisabled"
retries: 8
delay: 5
retries: 8
delay: 8
tags: upgrade_k8s, restart_node
- name: 设置node节点role

View File

@ -18,7 +18,7 @@
when: 'SERVICE_PROXY == "kube-proxy"'
- name: 停止 kube-proxy 服务
shell: "systemctl stop kube-proxy.service && systemctl disable kube-proxy.service"
shell: "systemctl stop kube-proxy.service; systemctl disable kube-proxy.service"
when: 'SERVICE_PROXY == "IPVS"'
ignore_errors: true
@ -47,3 +47,11 @@
- name: 删除默认cni配置
file: path=/etc/cni/net.d/10-default.conf state=absent
# 等待网络插件部署成功,视下载镜像速度而定
- name: 轮询等待kube-router 运行,视下载镜像速度而定
shell: "{{ bin_dir }}/kubectl get pod -n kube-system -o wide|grep 'kube-router'|grep ' {{ inventory_hostname }} '|awk '{print $3}'"
register: pod_status
until: pod_status.stdout == "Running"
retries: 12
delay: 8