k8s集群自动化管理

项目地址

https://github.com/TimeBye/kubeadm-ha

准备安装包

# 离线安装环境
curl -LO https://oss.choerodon.com.cn/kubeadm-ha/kubeadm-ha-base-amd64.tar
# 集群运行所需的镜像
curl -LO https://oss.choerodon.com.cn/kubeadm-ha/kubernetes-1.30.2-images-amd64.tgz
# CentOS 7 系统对应软件包
curl -LO https://oss.choerodon.com.cn/kubeadm-ha/centos7/kubernetes-1.30.2-centos7-amd64.tgz
# 克隆脚本
git clone -b release-1.27 https://mirror.ghproxy.com/github.com/TimeBye/kubeadm-ha.git

节点信息

ip hostname OS role
192.168.73.98 k8s-master3 CentOS 7.9 master etcd worker
192.168.73.99 k8s-master2 CentOS 7.9 master etcd worker
192.168.73.100 k8s-master1 CentOS 7.9 master etcd worker
192.168.73.101 k8s-node1 CentOS 7.9 worker
192.168.73.102 k8s-deplay CentOS 7.9 kubeadm-ha(ansible)

k8s-depaly 操作

解压离线包
tar -xzvf kubernetes-1.30.2-images-amd64.tgz
tar -xzvf kubernetes-1.30.2-centos7-amd64.tgz
配置yum源
cat <<EOF | tee /etc/yum.repos.d/kubeadm-ha.repo
[kubeadm-ha]
name=Kubeadm HA - \$basearch
baseurl=file:///data/packages/
enabled=1
gpgcheck=0
repo_gpgcheck=0
EOF
CentOS 类系统安装 containerd
# Kylin V10 需要移除以下软件包
yum remove -y selinux-policy python3-setools thin-provisioning-tools

yum install -y --disablerepo=\* --enablerepo=kubeadm-ha \
  containerd.io
配置 containerd
# root 为 containerd 存储目录,可修改为其他非共享存储目录。
cat <<EOF | tee /etc/containerd/config.toml
version = 2
root = "/var/lib/containerd"
state = "/run/containerd"
oom_score = -999
[grpc]
  max_recv_message_size = 16777216
  max_send_message_size = 16777216
[debug]
  level = "info"
[metrics]
  address = ""
  grpc_histogram = false
[plugins]
  [plugins."io.containerd.grpc.v1.cri"]
    sandbox_image = "registry.custom.local:12480/kubeadm-ha/pause:3.9"
    max_container_log_line_size = -1
    [plugins."io.containerd.grpc.v1.cri".containerd]
      default_runtime_name = "runc"
      snapshotter = "overlayfs"
      [plugins."io.containerd.grpc.v1.cri".containerd.runtimes]
        [plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc]
          runtime_type = "io.containerd.runc.v2"
          runtime_engine = ""
          runtime_root = ""
          [plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc.options]
            SystemdCgroup = true
    [plugins."io.containerd.grpc.v1.cri".registry]
      config_path = "/etc/containerd/certs.d"
EOF
配置 crictl 命令行
cat <<EOF | tee /etc/crictl.yaml
runtime-endpoint: unix:///var/run/containerd/containerd.sock
image-endpoint: unix:///var/run/containerd/containerd.sock
timeout: 30
debug: false
EOF

启动并加载 kubeadm-ha 镜像

systemctl enable containerd
systemctl restart containerd
gunzip 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值