调整安装步骤中kubectl的执行以适合公有云部署

pull/334/head
gjmzj 2018-09-15 11:27:33 +08:00
parent c3bac2979e
commit 6b21f30ab9
4 changed files with 9 additions and 0 deletions

View File

@ -6,9 +6,11 @@
tasks:
- name: 禁止业务 pod调度到 master节点
shell: "{{ bin_dir }}/kubectl cordon {{ inventory_hostname }} "
delegate_to: "{{ groups.deploy[0] }}"
when: DEPLOY_MODE != "allinone"
ignore_errors: true
- name: 设置master节点role
shell: "{{ bin_dir }}/kubectl label node {{ inventory_hostname }} kubernetes.io/role=master --overwrite"
ignore_errors: true
delegate_to: "{{ groups.deploy[0] }}"

View File

@ -22,9 +22,11 @@
tasks:
- name: 禁止业务 pod调度到 master节点
shell: "{{ bin_dir }}/kubectl cordon {{ inventory_hostname }} "
delegate_to: "{{ groups.deploy[0] }}"
when: DEPLOY_MODE != "allinone"
ignore_errors: true
- name: 设置master节点role
shell: "{{ bin_dir }}/kubectl label node {{ inventory_hostname }} kubernetes.io/role=master --overwrite"
ignore_errors: true
delegate_to: "{{ groups.deploy[0] }}"

View File

@ -65,5 +65,6 @@
until: result.rc == 0
retries: 5
delay: 6
delegate_to: "{{ groups.deploy[0] }}"
run_once: True
tags: upgrade_k8s, restart_master

View File

@ -97,6 +97,7 @@
- name: 获取csr 请求信息
shell: "sleep 3 && {{ bin_dir }}/kubectl get csr"
delegate_to: "{{ groups.deploy[0] }}"
register: csr_info
run_once: true
@ -104,11 +105,13 @@
shell: "{{ bin_dir }}/kubectl get csr|grep 'Pending' | awk 'NR>0{print $1}'| \
xargs {{ bin_dir }}/kubectl certificate approve"
when: '"Pending" in csr_info.stdout'
delegate_to: "{{ groups.deploy[0] }}"
run_once: true
- name: 轮询等待node达到Ready状态
shell: "{{ bin_dir }}/kubectl get node {{ inventory_hostname }}|awk 'NR>1{print $2}'"
register: node_status
delegate_to: "{{ groups.deploy[0] }}"
until: node_status.stdout == "Ready" or node_status.stdout == "Ready,SchedulingDisabled"
retries: 8
delay: 8
@ -117,3 +120,4 @@
- name: 设置node节点role
shell: "{{ bin_dir }}/kubectl label node {{ inventory_hostname }} kubernetes.io/role=node --overwrite"
ignore_errors: true
delegate_to: "{{ groups.deploy[0] }}"