二进制安装k8s-1.20.4之搭建etcd集群
2022/5/5 23:43:38
本文主要是介绍二进制安装k8s-1.20.4之搭建etcd集群,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
1、部署etcd文件
cd /data/app/k8s-ssl/ cp ca.pem kubernetes-key.pem kubernetes.pem /data/app/etcd/ssl/
2、 创建etcd服务配置文件
vim etcd.sh
ETCD_NAME=`hostname` INTERNAL_IP=`hostname -i` INITIAL_CLUSTER=zy-nph-skg-fat-channel-redis-yace01=https://172.31.170.15:2380,zy-nph-skg-fat-channel-redis-yace02=https://172.31.170.16:2380,zy-nph-skg-fat-channel-redis-yace03=https://172.31.170.17:2380 SSL_PATH=/data/app/etcd/ssl cat << EOF | sudo tee /etc/systemd/system/etcd.service [Unit] Description=etcd Documentation=https://github.com/coreos [Service] ExecStart=/usr/local/bin/etcd \\ --name ${ETCD_NAME} \\ --cert-file=${SSL_PATH}/kubernetes.pem \\ --key-file=${SSL_PATH}/kubernetes-key.pem \\ --peer-cert-file=${SSL_PATH}/kubernetes.pem \\ --peer-key-file=${SSL_PATH}/kubernetes-key.pem \\ --trusted-ca-file=${SSL_PATH}/ca.pem \\ --peer-trusted-ca-file=${SSL_PATH}/ca.pem \\ --peer-client-cert-auth \\ --client-cert-auth \\ --initial-advertise-peer-urls https://${INTERNAL_IP}:2380 \\ --listen-peer-urls https://${INTERNAL_IP}:2380 \\ --listen-client-urls https://${INTERNAL_IP}:2379,https://127.0.0.1:2379 \\ --advertise-client-urls https://${INTERNAL_IP}:2379 \\ --initial-cluster-token etcd-cluster-0 \\ --initial-cluster ${INITIAL_CLUSTER} \\ --initial-cluster-state new \\ --data-dir=/data/app/etcd/data Restart=on-failure RestartSec=5 [Install] WantedBy=multi-user.target EOF
3、 启动etcd集群服务
systemctl daemon-reload
systemctl enable etcd
systemctl start etcd
4、 验证etcd集群服务
export ETCDCTL_API=3 etcdctl --endpoints="172.31.170.15:2379,172.31.170.16:2379,172.31.170.17:2379" --cacert=/data/app/etcd/ssl/ca.pem --cert=/data/app/etcd/ssl/kubernetes.pem --key=/data/app/etcd/ssl/kubernetes-key.pem endpoint status --write-out=table etcdctl --endpoints="172.31.170.15:2379,172.31.170.16:2379,172.31.170.17:2379" --cacert=/data/app/etcd/ssl/ca.pem --cert=/data/app/etcd/ssl/kubernetes.pem --key=/data/app/etcd/ssl/kubernetes-key.pem endpoint health --write-out=table
这篇关于二进制安装k8s-1.20.4之搭建etcd集群的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-12-20/kubernetes 1.32版本更新解读:新特性和变化一目了然
- 2024-12-19拒绝 Helm? 如何在 K8s 上部署 KRaft 模式 Kafka 集群?
- 2024-12-16云原生周刊:Kubernetes v1.32 正式发布
- 2024-12-13Kubernetes上运行Minecraft:打造开发者平台的例子
- 2024-12-12深入 Kubernetes 的健康奥秘:探针(Probe)究竟有多强?
- 2024-12-10运维实战:K8s 上的 Doris 高可用集群最佳实践
- 2024-12-022024年最好用的十大Kubernetes工具
- 2024-12-02OPA守门人:Kubernetes集群策略编写指南
- 2024-11-26云原生周刊:K8s 严重漏洞
- 2024-11-15在Kubernetes (k8s) 中搭建三台 Nginx 服务器怎么实现?-icode9专业技术文章分享