如何安装配置ETCD

本篇内容主要讲解“如何安装配置ETCD”,感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习“如何安装配置ETCD”吧!

本篇内容主要讲解“如何安装配置ETCD”,感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习“如何安装配置ETCD”吧!
Master: 192.168.56.101
Worker node1: 192.168.56.102

Worker node2: 192.168.56.103
在安装k8s之前,手动安装配置etcd下载etcd

https://github.com/etcd-io/etcd/releases/download/v3.2.30/etcd-v3.2.30-linux-amd64.tar.gz
传到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},http://127.0.0.1:2379 \
--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

当前题目:如何安装配置ETCD
路径分享:https://www.cdcxhl.com/article26/epgpjg.html

成都网站建设公司_创新互联,为您提供自适应网站外贸建站用户体验移动网站建设营销型网站建设App开发

广告

声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 创新互联

成都定制网站网页设计