Add retry_stagger var for failed download/pushes.

* Add the retry_stagger var to tweak push and retry time strategies.
* Add large deployments related docs.

Signed-off-by: Bogdan Dobrelya <bdobrelia@mirantis.com>
pull/488/head
Bogdan Dobrelya 2016-09-15 11:23:27 +02:00
parent 9926395e5b
commit 390764c2b4
8 changed files with 30 additions and 9 deletions

View File

@ -0,0 +1,19 @@
Large deployments of K8s
========================
For a large scaled deployments, consider the following configuration changes:
* Tune [ansible settings](http://docs.ansible.com/ansible/intro_configuration.html)
for `forks` and `timeout` vars to fit large numbers of nodes being deployed.
* Override containers' `foo_image_repo` vars to point to intranet registry.
* Override the ``download_run_once: true`` to download binaries and container
images only once then push to nodes in batches.
* Adjust the `retry_stagger` global var as appropriate. It should provide sane
load on a delegate (the first K8s master node) then retrying failed
push or download operations.
For example, when deploying 200 nodes, you may want to run ansible with
``--forks=50``, ``--timeout=600`` and define the ``retry_stagger: 60``.

View File

@ -7,6 +7,8 @@ bin_dir: /usr/local/bin
# Where the binaries will be downloaded.
# Note: ensure that you've enough disk space (about 1G)
local_release_dir: "/tmp/releases"
# Random shifts for retrying failed ops like pushing/downloading
retry_stagger: 5
# Uncomment this line for CoreOS only.
# Directory where python binary is installed

View File

@ -30,7 +30,7 @@
register: keyserver_task_result
until: keyserver_task_result|success
retries: 4
delay: "{{ 20 | random + 3 }}"
delay: "{{ retry_stagger | random + 3 }}"
with_items: "{{ docker_repo_key_info.repo_keys }}"
when: ansible_os_family != "CoreOS"
@ -58,7 +58,7 @@
register: docker_task_result
until: docker_task_result|success
retries: 4
delay: "{{ 20 | random + 3 }}"
delay: "{{ retry_stagger | random + 3 }}"
with_items: "{{ docker_package_info.pkgs }}"
when: (ansible_os_family != "CoreOS") and (docker_package_info.pkgs|length > 0)

View File

@ -22,7 +22,7 @@
register: get_url_result
until: "'OK' in get_url_result.msg or 'file already exists' in get_url_result.msg"
retries: 4
delay: "{{ 20 | random + 3 }}"
delay: "{{ retry_stagger | random + 3 }}"
when: "{{ download.enabled|bool and not download.container|bool }}"
delegate_to: "{{ groups['kube-master'][0] if download_run_once|bool else omit }}"
run_once: "{{ download_run_once|bool }}"
@ -63,7 +63,7 @@
register: pull_task_result
until: pull_task_result.rc == 0
retries: 4
delay: "{{ 20 | random + 3 }}"
delay: "{{ retry_stagger | random + 3 }}"
when: "{{ download.enabled|bool and download.container|bool }}"
delegate_to: "{{ groups['kube-master'][0] if download_run_once|bool else omit }}"
run_once: "{{ download_run_once|bool }}"
@ -85,7 +85,7 @@
register: get_task
until: get_task|success
retries: 4
delay: "{{ 20 | random + 3 }}"
delay: "{{ retry_stagger | random + 3 }}"
when: ansible_os_family != "CoreOS" and inventory_hostname != groups['kube-master'][0] and download_run_once|bool
- name: Download | load container images

View File

@ -20,7 +20,7 @@
register: etcd_task_result
until: etcd_task_result.rc == 0
retries: 4
delay: "{{ 20 | random + 3 }}"
delay: "{{ retry_stagger | random + 3 }}"
changed_when: false
#Plan B: looks nicer, but requires docker-py on all hosts:

View File

@ -12,7 +12,7 @@
register: kube_task_result
until: kube_task_result.rc == 0
retries: 4
delay: "{{ 20 | random + 3 }}"
delay: "{{ retry_stagger | random + 3 }}"
changed_when: false
- name: Write kube-apiserver manifest

View File

@ -104,7 +104,7 @@
register: pkgs_task_result
until: pkgs_task_result|success
retries: 4
delay: "{{ 20 | random + 3 }}"
delay: "{{ retry_stagger | random + 3 }}"
with_items: "{{required_pkgs | default([]) | union(common_required_pkgs|default([]))}}"
when: ansible_os_family != "CoreOS"

View File

@ -48,7 +48,7 @@
register: cni_task_result
until: cni_task_result.rc == 0
retries: 4
delay: "{{ 20 | random + 3 }}"
delay: "{{ retry_stagger | random + 3 }}"
changed_when: false
when: use_hyperkube_cni