Skip to content

Commit

Permalink
增加等待kube-apiserver/kubelet启动延迟
Browse files Browse the repository at this point in the history
  • Loading branch information
jmgao1983 committed Nov 26, 2017
1 parent 25c49c9 commit e829108
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 2 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# 利用Ansible部署kubernetes集群

![docker](./pics/docker.jpg) ![kube](./pics/kube.jpg) ![ansible](./pics/ansible.jpg)

本文档记录自己实践部署高可用k8s集群的过程,利用ansible-playbook简化二进制方式部署过程。

网上有很多类似shell脚本和ansible部署版本,要不看得太复杂,或者久未更新,所以这里自己造轮子吧。
Expand Down
Binary file added pic/ansible.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added pic/docker.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added pic/kube.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 4 additions & 2 deletions roles/kube-node/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

0 comments on commit e829108

Please sign in to comment.