ETC集群配置 yum install etcd 安装 etcd每台安装步骤都一样,所以etcd2、etcd3都以etcd1步骤一样 安装只需一条命令即可: yum -y install etcd
修改配置文件 ETCD_DATA_DIR=”/var/lib/etcd/etcd01″ ETCD_LISTEN_PEER_URLS=”http://192.168.15.1:2380″ ETCD_LISTEN_CLIENT_URLS=”http://127.0.0.1:2379,http://192.168.15.1:2379″ ETCD_NAME=”etcd01″ ETCD_INITIAL_ADVERTISE_PEER_URLS=”http://192.168.15.1:2380″ ETCD_ADVERTISE_CLIENT_URLS=”http://192.168.15.1:2379″ ETCD_INITIAL_CLUSTER=”etcd01=http://192.168.15.1:2380,etcd02=http://192.168.15.2:2380,etcd03=http://192.168.15.3:2380″ ETCD_INITIAL_CLUSTER_TOKEN=”etcd-cluster” ETCD_INITIAL_CLUSTER_STATE=”new”
vi /usr/lib/systemd/system/etcd.service 新增
ExecStart=/bin/bash -c “GOMAXPROCS=$(nproc) /usr/bin/etcd –name=”${ETCD_NAME}” –data-dir=”${ETCD_DATA_DIR}” –listen-client-urls=”${ETCD_LISTEN_CLIENT_URLS}” –listen-peer-urls=”${ETCD_LISTEN_PEER_URLS}” –advertise-client-urls=”${ETCD_ADVERTISE_CLIENT_URLS}” –initial-cluster-token=”${ETCD_INITIAL_CLUSTER_TOKEN}” –initial-cluster=”${ETCD_INITIAL_CLUSTER}” –initial-cluster-state=”${ETCD_INITIAL_CLUSTER_STATE}”
修改data-dir文件夹权限 chmod –R 777 /var/lib/etcd
[root@master01 member]# etcdctl member list 5bb3134465862e70: name=etcd03 peerURLs=http://192.168.15.3:2380 clientURLs=http://192.168.15.3:2379 isLeader=false 7760d3410f15c71b: name=etcd02 peerURLs=http://192.168.15.2:2380 clientURLs=http://192.168.15.2:2379 isLeader=false ca8d009d60a70df4: name=etcd01 peerURLs=http://192.168.15.1:2380 clientURLs=http://192.168.15.1:2379 isLeader=true
至此,etcd集群已配置完成。接下来可以对kubernetes集群apiserver配置文件进行修改,使其指向etcd集群 #修改master节点,apiserver配置文件 [root@master ~]# cat /etc/kubernetes/apiserver