增加等待kube-apiserver/kubelet启动延迟

pull/275/head
jmgao 2017-11-26 12:36:58 +08:00
parent 25c49c9cf4
commit e8291088ed
5 changed files with 6 additions and 2 deletions

View File

@ -1,5 +1,7 @@
# 利用Ansible部署kubernetes集群
![docker](./pics/docker.jpg) ![kube](./pics/kube.jpg) ![ansible](./pics/ansible.jpg)
本文档记录自己实践部署高可用k8s集群的过程利用ansible-playbook简化二进制方式部署过程。
网上有很多类似shell脚本和ansible部署版本要不看得太复杂或者久未更新所以这里自己造轮子吧。

BIN
pic/ansible.jpg 100644

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

BIN
pic/docker.jpg 100644

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

BIN
pic/kube.jpg 100644

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.0 KiB

View File

@ -7,8 +7,9 @@
# kubelet 启动时向 kube-apiserver 发送 TLS bootstrapping 请求,需要绑定该角色
# 只需单节点执行一次,重复执行的报错可以忽略
# 增加15s等待kube-apiserver正常工作
- name: kubelet-bootstrap-setting
shell: "{{ bin_dir }}/kubectl create clusterrolebinding kubelet-bootstrap \
shell: "sleep 15 && {{ bin_dir }}/kubectl create clusterrolebinding kubelet-bootstrap \
--clusterrole=system:node-bootstrapper --user=kubelet-bootstrap"
when: NODE_ID is defined and NODE_ID == "node1"
ignore_errors: true
@ -120,9 +121,10 @@
template: src=calico-kube-controllers.yaml.j2 dest=/root/local/kube-system/calico/calico-kube-controllers.yaml
# 只需单节点执行一次,重复执行的报错可以忽略
# 增加15s等待node ready
- name: 运行calico-kube-controllers
tags: calico-controller
shell: "{{ bin_dir }}/kubectl create -f /root/local/kube-system/calico/rbac.yaml && \
shell: "sleep 15 && {{ bin_dir }}/kubectl create -f /root/local/kube-system/calico/rbac.yaml && \
{{ bin_dir }}/kubectl create -f /root/local/kube-system/calico/calico-kube-controllers.yaml"
when: NODE_ID is defined and NODE_ID == "node1"
ignore_errors: true