1 Star 0 Fork 3

AllenLiuOSC / kubeadm-ha

forked from 平安 / kubeadm-ha 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
83-add-etcd.yml 1.75 KB
一键复制 编辑 原始数据 按行查看 历史
- hosts: all
gather_facts: false
tasks:
- name: "设置代理服务器环境变量"
set_fact:
proxy_env:
http_proxy: "{{ http_proxy | default ('') }}"
HTTP_PROXY: "{{ http_proxy | default ('') }}"
https_proxy: "{{ https_proxy | default ('') }}"
HTTPS_PROXY: "{{ https_proxy | default ('') }}"
no_proxy: "{{ no_proxy | default ('') }}"
NO_PROXY: "{{ no_proxy | default ('') }}"
no_log: true
- hosts: new-etcd[0]
tasks:
- name: 校验 new-etcd 节点组数量
assert:
that: groups['new-etcd']|length <= 1
msg: "同时只能添加一个 etcd 节点。"
- hosts:
- new-etcd
roles:
- prepare/variables
- prepare/base
- prepare/container-engine
- prepare/kubernetes
environment: "{{ proxy_env }}"
- hosts:
- etcd
- new-etcd
roles:
- prepare/variables
- etcd/certificates
- etcd/install
# 添加etcd节点后刷新master节点kubeadm配置
- hosts:
- kube-master
roles:
- prepare/variables
- kube-master
# 标记各节点角色
- hosts:
- new-etcd
roles:
- prepare/variables
- post
- hosts:
- kube-master
roles:
- prepare/variables
tasks:
- name: "更新第一个 master 节点:{{ inventory_hostname }} 的配置"
shell: >
kubeadm upgrade apply --config=/etc/kubernetes/kubeadm-config.yaml --force --ignore-preflight-errors=ImagePull
when: inventory_hostname == groups['kube-master'][0]
- name: "更新 master 节点:{{ inventory_hostname }} 的配置"
shell: >
kubeadm upgrade node
{% if kube_version.split('.')[1]|int == 13 %}
experimental-control-plane
{% endif %}
when:
- inventory_hostname != groups['kube-master'][0]
- inventory_hostname in groups['kube-master']
1
https://gitee.com/allenliuosc/kubeadm-ha.git
git@gitee.com:allenliuosc/kubeadm-ha.git
allenliuosc
kubeadm-ha
kubeadm-ha
master

搜索帮助