K8S 1.9.0二进制包部署(一)

本文详细介绍如何从零开始搭建Kubernetes集群,包括安装Docker、配置etcd服务等关键步骤,并提供具体命令行操作示例。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

master 192.168.254.53
node1 192.168.254.54
node2 192.168.254.55

版本信息:
k8s V1.9.0 下载https://github.com/kubernetes/kubernetes/blob/master/CHANGELOG-1.9.md
etcd v3.2.10
flannel v0.9.0
docker 17.05.0-ce

systemctl disable firewalld
systemctl stop firewalld

1、安装docker

先更新yum源,这里用163的源
yum install -y wget
cd /etc/yum.repos.d
wget http://mirrors.163.com/.help/CentOS7-Base-163.repo
/usr/bin/yum clean all
/usr/bin/yum makecache
更新系统
yum update
编辑生成docker的yum源
tee /etc/yum.repos.d/docker.repo <<-'EOF'
[dockerrepo]
name=Docker Repository
baseurl=https://yum.dockerproject.org/repo/main/centos/7/
enabled=1
gpgcheck=1
gpgkey=https://yum.dockerproject.org/gpg
EOF
查看版本
yum info docker-engine
yum install docker-engine -y

systemctl enable docker.service
systemctl start docker.service
systemctl status docker.service

2、etcd

cp etcd etcdctl /usr/bin
chmod 755 /usr/bin/etcd
chmod 755 /usr/bin/etcdctl
mkdir -p /app/etcd/data
mkdir -p /app/etcd/conf

vi /usr/lib/systemd/system/etcd.service
[Unit]
Description=Etcd Server
After=network.target
[Service]
Type=notify
WorkingDirectory=/app/etcd/data
EnvironmentFile=/app/etcd/conf/etcd.conf
ExecStart=/usr/bin/etcd
[Install]
WantedBy=multi-user.target

vi /app/etcd/conf/etcd.conf
ETCD_NAME=default
ETCD_DATA_DIR="/app/etcd/data/default.etcd"
ETCD_LISTEN_CLIENT_URLS="http://0.0.0.0:2379,http://0.0.0.0:4001"
ETCD_ADVERTISE_CLIENT_URLS="http://0.0.0.0:2379,http://0.0.0.0:4001"

systemctl daemon-reload
systemctl enable etcd.service
systemctl start etcd.service
systemctl status etcd.service

etcdctl --version
etcdctl cluster-health
etcdctl -C http://localhost:2379 cluster-health
curl -L http://localhost:2379/health
[root@testapp3 ~]# etcdctl set testkey "hello world"
hello world
[root@testapp3 ~]# etcdctl get testkey
hello world

转载于:https://blog.51cto.com/285534/2068958

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值