Browse Source

Wait for static pods when setting up

Fixes #390
pull/398/head
Matthew Mosesohn 8 years ago
parent
commit
e38258381f
2 changed files with 37 additions and 9 deletions
  1. 37
      roles/kubernetes/master/handlers/main.yml
  2. 9
      roles/kubernetes/master/tasks/main.yml

37
roles/kubernetes/master/handlers/main.yml

@ -1,4 +1,35 @@
---
- name: restart kube-apiserver
set_fact:
restart_apimaster: True
- name: Master | restart kubelet
command: /bin/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

9
roles/kubernetes/master/tasks/main.yml

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