安裝配置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
- centos7 (阿里雲、linux) 單機spark的安裝與配置詳解(jdk安裝與配置,scala安裝與配置,hadoop安裝與配置,spark安裝與配置)CentOS阿里LinuxSparkJDKHadoop
- Etcd叢集靜態配置
- leanote安裝配置
- JENKINS安裝配置Jenkins
- oracle安裝配置Oracle
- ceph安裝配置
- 【mongodb安裝配置】MongoDB
- ELK 安裝配置
- SwitchOmega 安裝配置
- MySQL安裝配置MySql
- JWT安裝配置JWT
- Prometheus安裝配置Prometheus
- MariaDB 安裝配置
- ccache安裝配置
- alertmanager安裝配置
- VNC安裝配置VNC
- Hive安裝配置Hive
- Zookeeper 安裝配置
- SSH免密登入+JDK安裝配置+Hadoop安裝配置JDKHadoop
- CentOS 7 安裝、配置、使用 PostgreSQL 10 安裝及基礎配置CentOSSQL
- Linux下安裝java及配置(yum安裝)LinuxJava
- Mysql for Linux安裝配置之—— rpm(bundle)安裝MySqlLinux
- Mysql for Linux安裝配置之—— 原始碼安裝MySqlLinux原始碼
- MySQL安裝之二_安裝配置泥潭版MySql
- CentOS安裝配置yumCentOS
- CentOS redis安裝配置CentOSRedis
- Jenkins安裝及配置Jenkins
- Supervisor安裝與配置
- Nginx安裝與配置Nginx
- pip安裝源配置
- zabbix的安裝配置
- hbase 2.0.2安裝配置
- MongoDB安裝配置教程MongoDB