安裝配置ETCD
Master: 192.168.56.101
Worker node1: 192.168.56.102
Worker node2: 192.168.56.103
在安裝k8s之前,手動安裝配置etcd
下載etcd
傳到3節點,解壓壓縮包
mkdir /opt/etcd/{bin,cfg,ssl} -p
tar -zxvf etcd-v3.2.30-linux-amd64.tar.gz -C ./
mv etcd-v3.2.30-linux-amd64/{etcd,etcdctl} /opt/etcd/bin/
master節點配置檔案 /opt/etcd/cfg/etcd
#[Member]
ETCD_NAME="etcd-1"
ETCD_DATA_DIR="/var/lib/etcd/default.etcd"
ETCD_LISTEN_PEER_URLS="https://192.168.56.101:2380"
ETCD_LISTEN_CLIENT_URLS="https://192.168.56.101:2379"
#[Clustering]
ETCD_INITIAL_ADVERTISE_PEER_URLS="https://192.168.56.101:2380"
ETCD_ADVERTISE_CLIENT_URLS="https://192.168.56.101:2379"
ETCD_INITIAL_CLUSTER="etcd-1=https://192.168.56.101:2380,etcd-2=https://192.168.56.102:2380,etcd-3=https://192.168.56.103:2380"
ETCD_INITIAL_CLUSTER_TOKEN="etcd-cluster"
ETCD_INITIAL_CLUSTER_STATE="new"
Worker node1節點配置檔案 /opt/etcd/cfg/etcd
#[Member]
ETCD_NAME="etcd-2"
ETCD_DATA_DIR="/var/lib/etcd/default.etcd"
ETCD_LISTEN_PEER_URLS="https://192.168.56.102:2380"
ETCD_LISTEN_CLIENT_URLS="https://192.168.56.102:2379"
#[Clustering]
ETCD_INITIAL_ADVERTISE_PEER_URLS="https://192.168.56.102:2380"
ETCD_ADVERTISE_CLIENT_URLS="https://192.168.56.102:2379"
ETCD_INITIAL_CLUSTER="etcd-1=https://192.168.56.101:2380,etcd-2=https://192.168.56.102:2380,etcd-3=https://192.168.56.103:2380"
ETCD_INITIAL_CLUSTER_TOKEN="etcd-cluster"
ETCD_INITIAL_CLUSTER_STATE="new"
Worker node2節點配置檔案 /opt/etcd/cfg/etcd
#[Member]
ETCD_NAME="etcd-3"
ETCD_DATA_DIR="/var/lib/etcd/default.etcd"
ETCD_LISTEN_PEER_URLS="https://192.168.56.103:2380"
ETCD_LISTEN_CLIENT_URLS="https://192.168.56.103:2379"
#[Clustering]
ETCD_INITIAL_ADVERTISE_PEER_URLS="https://192.168.56.103:2380"
ETCD_ADVERTISE_CLIENT_URLS="https://192.168.56.103:2379"
ETCD_INITIAL_CLUSTER="etcd-1=https://192.168.56.101:2380,etcd-2=https://192.168.56.102:2380,etcd-3=https://192.168.56.103:2380"
ETCD_INITIAL_CLUSTER_TOKEN="etcd-cluster"
ETCD_INITIAL_CLUSTER_STATE="new"
master節點,Worker node1, Worker node2 配置檔案 /usr/lib/systemd/system/etcd.service
[Unit]
Description=Etcd Server
After=network.target
After=network-online.target
Wants=network-online.target
[Service]
Type=notify
EnvironmentFile=/opt/etcd/cfg/etcd
ExecStart=/opt/etcd/bin/etcd \
--name=${ETCD_NAME} \
--data-dir=${ETCD_DATA_DIR} \
--listen-peer-urls=${ETCD_LISTEN_PEER_URLS} \
--listen-client-urls=${ETCD_LISTEN_CLIENT_URLS}, \
--advertise-client-urls=${ETCD_ADVERTISE_CLIENT_URLS} \
--initial-advertise-peer-urls=${ETCD_INITIAL_ADVERTISE_PEER_URLS} \
--initial-cluster=${ETCD_INITIAL_CLUSTER} \
--initial-cluster-token=${ETCD_INITIAL_CLUSTER_TOKEN} \
--initial-cluster-state=new \
--cert-file=/opt/etcd/ssl/server.pem \
--key-file=/opt/etcd/ssl/server-key.pem \
--peer-cert-file=/opt/etcd/ssl/server.pem \
--peer-key-file=/opt/etcd/ssl/server-key.pem \
--trusted-ca-file=/opt/etcd/ssl/ca.pem \
--peer-trusted-ca-file=/opt/etcd/ssl/ca.pem
Restart=on-failure
LimitNOFILE=65536
[Install]
WantedBy=multi-user.target
將之前生成的證書複製到/opt/etcd/ssl
cp ca*pem server*pem /opt/etcd/ssl
啟動並設定開機啟動
systemctl start etcd
systemctl enable etcd
檢查一下叢集的狀態
/opt/etcd/bin/etcdctl --ca-file=/opt/etcd/ssl/ca.pem --cert-file=/opt/etcd/ssl/server.pem --key-file=/opt/etcd/ssl/server-key.pem --endpoints="https://192.168.56.101:2379,https://192.168.56.102:2379,https://192.168.56.103:2379" cluster-health
member 181ffe2d394f445b is healthy: got healthy result from https://192.168.56.101:2379
member 737ab8edec59b6e6 is healthy: got healthy result from https://192.168.56.102:2379
member 87a3a196a794e8f0 is healthy: got healthy result from https://192.168.56.103:2379
cluster is healthy
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/725820/viewspace-2689897/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- etcd套路(三)etcd的安裝
- Kubernetes安裝之三:etcd叢集的配置
- 二進位制檔案安裝安裝etcd
- go get 安裝 go.etcd.io etcd clientv3 報錯Goclient
- 本地windows搭建spark環境,安裝與詳細配置(jdk安裝與配置,scala安裝與配置,hadoop安裝與配置,spark安裝與配置)WindowsSparkJDKHadoop
- Docker 高可用配置中心EtcdDocker
- 一、配置etcd資料庫資料庫
- zabbix安裝—–nginx安裝和配置Nginx
- Zookeeper 安裝配置
- 【mongodb安裝配置】MongoDB
- ceph安裝配置
- ELK 安裝配置
- Prometheus安裝配置Prometheus
- MySQL安裝配置MySql
- SwitchOmega 安裝配置
- Hive安裝配置Hive
- JWT安裝配置JWT
- oracle安裝配置Oracle
- VNC安裝配置VNC
- rlwrap 安裝配置
- otrs安裝配置
- Sybase安裝配置
- memcache安裝配置
- mfs安裝配置
- storm安裝配置ORM
- Mysql 安裝 配置MySql
- memcached 安裝配置
- Mycat 安裝配置
- ANT安裝、配置
- rcp 安裝配置
- alertmanager安裝配置
- centos7 (阿里雲、linux) 單機spark的安裝與配置詳解(jdk安裝與配置,scala安裝與配置,hadoop安裝與配置,spark安裝與配置)CentOS阿里LinuxSparkJDKHadoop
- MYSQL + MHA +keepalive + VIP安裝配置(一)--MYSQL安裝配置MySql
- CentOS 7 安裝、配置、使用 PostgreSQL 10 安裝及基礎配置CentOSSQL
- 安裝和配置Drupal 8教程,如何安裝和配置Drupal 8?
- MYSQL + MHA +keepalive + VIP安裝配置(三)--keepalived安裝配置MySql
- SSH免密登入+JDK安裝配置+Hadoop安裝配置JDKHadoop
- MySQL安裝之二_安裝配置泥潭版MySql