You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
--peer-trusted-ca-file:签名 peer 证书的 CA 证书,用于验证 peer 证书
4、为各ETCD节点创建和分发 etcd systemd unit 文件
4.1:替换模板文件中的变量
[root@k8s-master1 etcd]# for (( i=0; i < 3; i++ ))do
sed -e "s/##ETCD_NAME##/${ETCD_NAMES[i]}/" -e "s/##ETCD_IP##/${ETCD_IPS[i]}/" etcd.service.template > etcd-${ETCD_IPS[i]}.service
done
[root@k8s-master1 etcd]# ls *.service
etcd-192.168.66.62.service etcd-192.168.66.63.service etcd-192.168.66.64.service
4.2:分发生成的 systemd unit 文件
[root@k8s-master1 etcd]# for node_ip in ${ETCD_IPS[@]}doecho">>> ${node_ip}"
scp etcd-${node_ip}.service root@${node_ip}:/etc/systemd/system/etcd.service
done
4.3:检查配置文件
[root@k8s-master1 etcd]# ls /etc/systemd/system/etcd.service
/etc/systemd/system/etcd.service
[root@k8s-master1 etcd]# vim /etc/systemd/system/etcd.service
[root@k8s-master1 etcd]# for node_ip in ${ETCD_IPS[@]}doecho">>> ${node_ip}"
ssh root@${node_ip}"systemctl status etcd|grep Active"done
[root@k8s-master1 etcd]# for node_ip in ${ETCD_IPS[@]}doecho">>> ${node_ip}"
ssh root@${node_ip}"systemctl status etcd"done
7、验证服务状态
7.1:任一etcd节点执行以下命令
[root@k8s-master1 etcd]# for node_ip in ${ETCD_IPS[@]}doecho">>> ${node_ip}"
/opt/k8s/bin/etcdctl \
--endpoints=https://${node_ip}:2379 \
--cacert=/etc/kubernetes/cert/ca.pem \
--cert=/etc/etcd/cert/etcd.pem \
--key=/etc/etcd/cert/etcd-key.pem endpoint health
done