Wait for static pods when setting up

Fixes #390
This commit is contained in:
Matthew Mosesohn 2016-08-01 16:12:23 +03:00
parent e8a1c7a53f
commit e38258381f
2 changed files with 37 additions and 9 deletions

View file

@ -1,4 +1,35 @@
--- ---
- name: restart kube-apiserver - name: Master | restart kubelet
set_fact: command: /bin/true
restart_apimaster: True notify:
- Kubelet | reload systemd
- Kubelet | reload kubelet
- name: wait for master static pods
command: /bin/true
notify:
- wait for kube-scheduler
- wait for kube-controller-manager
- name: Master | reload systemd
command: systemctl daemon-reload
when: ansible_service_mgr == "systemd"
- name: Master | reload kubelet
service:
name: kubelet
state: restarted
- name: wait for kube-scheduler
uri: url=http://localhost:10251/healthz
register: scheduler_result
until: scheduler_result.status == 200
retries: 15
delay: 5
- name: wait for kube-controller-manager
uri: url=http://localhost:10252/healthz
register: controller_manager_result
until: controller_manager_result.status == 200
retries: 15
delay: 5

View file

@ -19,12 +19,7 @@
src: manifests/kube-apiserver.manifest.j2 src: manifests/kube-apiserver.manifest.j2
dest: "{{ kube_manifest_dir }}/kube-apiserver.manifest" dest: "{{ kube_manifest_dir }}/kube-apiserver.manifest"
register: apiserver_manifest register: apiserver_manifest
notify: Master | restart kubelet
- name: restart kubelet
service:
name: kubelet
state: restarted
when: apiserver_manifest.changed
- name: wait for the apiserver to be running - name: wait for the apiserver to be running
uri: url=http://localhost:8080/healthz uri: url=http://localhost:8080/healthz
@ -58,8 +53,10 @@
template: template:
src: manifests/kube-controller-manager.manifest.j2 src: manifests/kube-controller-manager.manifest.j2
dest: "{{ kube_manifest_dir }}/kube-controller-manager.manifest" dest: "{{ kube_manifest_dir }}/kube-controller-manager.manifest"
notify: wait for kube-controller-manager
- name: Write kube-scheduler manifest - name: Write kube-scheduler manifest
template: template:
src: manifests/kube-scheduler.manifest.j2 src: manifests/kube-scheduler.manifest.j2
dest: "{{ kube_manifest_dir }}/kube-scheduler.manifest" dest: "{{ kube_manifest_dir }}/kube-scheduler.manifest"
notify: wait for kube-scheduler