提取碼:7571
## etcd-v3.4.13-linux-amd64.tar.gz
[root@localhost ansible]# tree etcd_install/
etcd_install/
├── conf
│ └── run.sh
├── etcd.yml
├── id_rsa
├── inv
├── readme.txt
└── run.sh
etcd.yml配置檔案
- name: etcd集群安裝
hosts: all
gather_facts: no
remote_user: sa
become_user: root
serial: 3
vars:
tasks:
get_url:
url:
dest: /tmp/
mode: 0644
force: no
checksum: md5:b4a093f33fb75e49f2b53f8062ead621
become: yes
- name: 解壓安裝包到
unarchive:
src: /tmp/etcd-v3.4.13-linux-amd64.tar.gz
dest: /data/op/
remote_src: yes
args:
creates: /data/op/etcd-v3.4.13-linux-amd64/etcdctl
become: yes
- name: 傳輸檔案到 }
template:
src: ./conf/run.sh
dest: /data/op/etcd-v3.4.13-linux-amd64/
vars:
this_name: '$'
this_ip: '$'
when: inventory_hostname == (addr_1)
become: yes
- name: 傳輸檔案到 }
template:
src: ./conf/run.sh
dest: /data/op/etcd-v3.4.13-linux-amd64/
vars:
this_name: '$'
this_ip: '$'
when: inventory_hostname == (addr_2)
become: yes
- name: 傳輸檔案到 }
template:
src: ./conf/run.sh
dest: /data/op/etcd-v3.4.13-linux-amd64/
vars:
this_name: '$'
this_ip: '$'
when: inventory_hostname == (addr_3)
become: yes
- name: 啟動服務etcd
shell: nohup sh ./run.sh > /dev/null 2>&1 &
args:
chdir: /data/op/etcd-v3.4.13-linux-amd64/
become: yes
run.sh配置檔案
cd `dirname $0`
ip=`awk 'beginend}' inv`
addr_1=`awk 'nr == 1' inv | awk `
addr_2=`awk 'nr == 2' inv | awk `
addr_3=`awk 'nr == 3' inv | awk `
hostname_1=`awk 'nr == 1' inv | awk `
hostname_2=`awk 'nr == 2' inv | awk `
hostname_3=`awk 'nr == 3' inv | awk `
ansible_options="
-e addr_1=$addr_1
-e addr_2=$addr_2
-e addr_3=$addr_3
-e hostname_1=$hostname_1
-e hostname_2=$hostname_2
-e hostname_3=$hostname_3"
ansible-playbook -i $ \
$ansible_options \
--key-file "./id_rsa"\
etcd.yml $*
inv配置檔案
10.10.80.176 k8s-sl**e2
10.10.80.177 k8s-sl**e1
10.10.80.178 k8s-master
id_rsa配置檔案
三颱伺服器公用的私鑰
run.sh配置檔案
etcd集群部署
1 需要至少兩台伺服器,節點1 etd 1 192.168.0.1 節點2 etd 2 192.168.0.2 2 系統版本 centos7 3 埠2379 2380 4001的開放 一 重複以上步驟,不同的是配置檔案vim etc etcd conf.yml,為 name etcd 2 data ...
部署ETCD集群
環境介紹 10.0.0.179 etcd01 10,0,0,180 etcd02 10,0,0.181 etcd03 1.安裝cfssl證書生成工具 yum install y wget wget wget wget chmod x cfssl linux amd64 cfssljson linux...
linux centos 部署etcd集群
本文是在單台機器上搭建集群,多台搭建同理且更簡單,因為不用考慮埠以及各種目錄衝突問題,配置幾乎大多一樣,細微差別會在文中指出。cd opt wget tar zxvf etcd v3.3.10 linux amd64.tar.gz mv etcd v3.3.10 linux amd64 etcd c...