use init/upgrade strategy for kubeadm and ignore kubedns svc
This commit is contained in:
parent
014bb8072c
commit
9037e20284
3 changed files with 37 additions and 21 deletions
|
@ -296,18 +296,17 @@ before_script:
|
||||||
UPGRADE_TEST: "graceful"
|
UPGRADE_TEST: "graceful"
|
||||||
STARTUP_SCRIPT: ""
|
STARTUP_SCRIPT: ""
|
||||||
|
|
||||||
.coreos_weave_kubeadm_variables: &coreos_weave_kubeadm_variables
|
.centos_weave_kubeadm_variables: ¢os_weave_kubeadm_variables
|
||||||
# stage: deploy-gce-part1
|
# stage: deploy-gce-part1
|
||||||
KUBE_NETWORK_PLUGIN: weave
|
KUBE_NETWORK_PLUGIN: weave
|
||||||
AUTHORIZATION_MODES: "{ 'authorization_modes': [ 'RBAC' ] }"
|
AUTHORIZATION_MODES: "{ 'authorization_modes': [ 'RBAC' ] }"
|
||||||
CLOUD_IMAGE: coreos-stable-1465-6-0-v20170817
|
CLOUD_IMAGE: centos-7
|
||||||
CLOUD_MACHINE_TYPE: "n1-standard-1"
|
CLOUD_MACHINE_TYPE: "n1-standard-1"
|
||||||
CLOUD_REGION: us-central1-b
|
CLOUD_REGION: us-central1-b
|
||||||
BOOTSTRAP_OS: coreos
|
|
||||||
CLUSTER_MODE: ha
|
CLUSTER_MODE: ha
|
||||||
KUBEADM_ENABLED: "true"
|
KUBEADM_ENABLED: "true"
|
||||||
UPGRADE_TEST: "graceful"
|
UPGRADE_TEST: "graceful"
|
||||||
STARTUP_SCRIPT: 'systemctl disable locksmithd && systemctl stop locksmithd'
|
STARTUP_SCRIPT: ""
|
||||||
|
|
||||||
.ubuntu_canal_kubeadm_variables: &ubuntu_canal_kubeadm_variables
|
.ubuntu_canal_kubeadm_variables: &ubuntu_canal_kubeadm_variables
|
||||||
# stage: deploy-gce-part1
|
# stage: deploy-gce-part1
|
||||||
|
@ -531,24 +530,24 @@ ubuntu-canal-kubeadm-triggers:
|
||||||
when: on_success
|
when: on_success
|
||||||
only: ['triggers']
|
only: ['triggers']
|
||||||
|
|
||||||
coreos-weave-kubeadm-rbac:
|
centos-weave-kubeadm-rbac:
|
||||||
stage: deploy-gce-part1
|
stage: deploy-gce-part1
|
||||||
<<: *job
|
<<: *job
|
||||||
<<: *gce
|
<<: *gce
|
||||||
variables:
|
variables:
|
||||||
<<: *gce_variables
|
<<: *gce_variables
|
||||||
<<: *coreos_weave_kubeadm_variables
|
<<: *centos_weave_kubeadm_variables
|
||||||
when: manual
|
when: manual
|
||||||
except: ['triggers']
|
except: ['triggers']
|
||||||
only: ['master', /^pr-.*$/]
|
only: ['master', /^pr-.*$/]
|
||||||
|
|
||||||
coreos-weave-kubeadm-triggers:
|
centos-weave-kubeadm-triggers:
|
||||||
stage: deploy-gce-part1
|
stage: deploy-gce-part1
|
||||||
<<: *job
|
<<: *job
|
||||||
<<: *gce
|
<<: *gce
|
||||||
variables:
|
variables:
|
||||||
<<: *gce_variables
|
<<: *gce_variables
|
||||||
<<: *coreos_weave_kubeadm_variables
|
<<: *centos_weave_kubeadm_variables
|
||||||
when: on_success
|
when: on_success
|
||||||
only: ['triggers']
|
only: ['triggers']
|
||||||
|
|
||||||
|
|
|
@ -61,11 +61,20 @@
|
||||||
register: kubeadm_config
|
register: kubeadm_config
|
||||||
|
|
||||||
- name: kubeadm | Initialize first master
|
- name: kubeadm | Initialize first master
|
||||||
command: timeout -k 240s 240s kubeadm upgrade --config={{ kube_config_dir }}/kubeadm-config.yaml --skip-preflight-checks
|
command: timeout -k 240s 240s kubeadm init --config={{ kube_config_dir }}/kubeadm-config.yaml --skip-preflight-checks
|
||||||
register: kubeadm_init
|
register: kubeadm_init
|
||||||
#Retry is because upload config sometimes fails
|
#Retry is because upload config sometimes fails
|
||||||
retries: 3
|
retries: 3
|
||||||
when: inventory_hostname == groups['kube-master']|first and (kubeadm_config.changed or not admin_conf.stat.exists)
|
when: inventory_hostname == groups['kube-master']|first and not admin_conf.stat.exists
|
||||||
|
failed_when: kubeadm_init.rc != 0 and "field is immutable" not in kubeadm_init.stderr
|
||||||
|
|
||||||
|
- name: kubeadm | Upgrade first master
|
||||||
|
command: timeout -k 240s 240s kubeadm upgrade apply --config={{ kube_config_dir }}/kubeadm-config.yaml {{ kube_version }} --skip-preflight-checks
|
||||||
|
register: kubeadm_upgrade
|
||||||
|
#Retry is because upload config sometimes fails
|
||||||
|
retries: 3
|
||||||
|
when: inventory_hostname == groups['kube-master']|first and (kubeadm_config.changed and admin_conf.stat.exists)
|
||||||
|
failed_when: kubeadm_upgrade.rc != 0 and "field is immutable" not in kubeadm_upgrade.stderr
|
||||||
|
|
||||||
- name: slurp kubeadm certs
|
- name: slurp kubeadm certs
|
||||||
slurp:
|
slurp:
|
||||||
|
@ -99,17 +108,17 @@
|
||||||
with_items: "{{ kubeadm_certs.results }}"
|
with_items: "{{ kubeadm_certs.results }}"
|
||||||
when: inventory_hostname != groups['kube-master']|first
|
when: inventory_hostname != groups['kube-master']|first
|
||||||
|
|
||||||
- name: kubeadm | Quick join other masters
|
- name: kubeadm | Init other uninitialized masters
|
||||||
command: timeout -k 240s 240s kubeadm alpha phase {{ item }} --config={{ kube_config_dir }}/kubeadm-config.yaml --skip-preflight-checks
|
command: timeout -k 240s 240s kubeadm init --config={{ kube_config_dir }}/kubeadm-config.yaml --skip-preflight-checks
|
||||||
register: kubeadm_init
|
register: kubeadm_init
|
||||||
#Retry is because upload config sometimes fails
|
when: inventory_hostname != groups['kube-master']|first and not admin_conf.stat.exists
|
||||||
retries: 3
|
failed_when: kubeadm_init.rc != 0 and "field is immutable" not in kubeadm_init.stderr
|
||||||
with_items:
|
|
||||||
- controlplane apiserver
|
- name: kubeadm | Upgrade first master
|
||||||
- controlplane scheduler
|
command: timeout -k 240s 240s kubeadm upgrade apply --config={{ kube_config_dir }}/kubeadm-config.yaml {{ kube_version }} --skip-preflight-checks
|
||||||
- controlplane controller-manager
|
register: kubeadm_upgrade
|
||||||
- bootstrap mark-master
|
when: inventory_hostname != groups['kube-master']|first and (kubeadm_config.changed and admin_conf.stat.exists)
|
||||||
when: inventory_hostname != groups['kube-master']|first and (kubeadm_config.changed or not admin_conf.stat.exists or copy_kubeadm_certs.changed)
|
failed_when: kubeadm_upgrade.rc != 0 and "field is immutable" not in kubeadm_upgrade.stderr
|
||||||
|
|
||||||
- name: kubeadm | Check service account key again
|
- name: kubeadm | Check service account key again
|
||||||
stat:
|
stat:
|
||||||
|
|
|
@ -19,12 +19,20 @@
|
||||||
when: kubeadm_enabled
|
when: kubeadm_enabled
|
||||||
tags: kubeadm
|
tags: kubeadm
|
||||||
|
|
||||||
- name: install | Copy binary from download dir
|
- name: install | Copy kubeadm binary from download dir
|
||||||
command: rsync -piu "{{ local_release_dir }}/kubeadm" "{{ bin_dir }}/kubeadm"
|
command: rsync -piu "{{ local_release_dir }}/kubeadm" "{{ bin_dir }}/kubeadm"
|
||||||
changed_when: false
|
changed_when: false
|
||||||
when: kubeadm_enabled
|
when: kubeadm_enabled
|
||||||
tags: kubeadm
|
tags: kubeadm
|
||||||
|
|
||||||
|
- name: install | Set kubeadm binary permissions
|
||||||
|
file:
|
||||||
|
path: "{{ bin_dir }}/kubeadm"
|
||||||
|
mode: "0755"
|
||||||
|
state: file
|
||||||
|
when: kubeadm_enabled
|
||||||
|
tags: kubeadm
|
||||||
|
|
||||||
- include: "install_{{ kubelet_deployment_type }}.yml"
|
- include: "install_{{ kubelet_deployment_type }}.yml"
|
||||||
|
|
||||||
- name: install | Write kubelet systemd init file
|
- name: install | Write kubelet systemd init file
|
||||||
|
|
Loading…
Reference in a new issue