当前位置: 首页 > article >正文

kubernetes v1.24.7 + docker

1. 背景

采用containerd作为容器运行时发现集群总是不稳定,因此切换成了docker 作为容器运行时;

root@orangepi3b:~# uname -a
Linux orangepi3b 5.10.160-rockchip-rk356x #1.0.2 SMP Thu Sep 21 17:07:22 CST 2023 aarch64 aarch64 aarch64 GNU/Linux

2. 安装docker

apt-get update
    # apt-get install -y docker.io
    apt-get install -y ca-certificates curl gnupg lsb-release
    mkdir -p /etc/apt/keyrings
    curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg
    echo \
    "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
    $(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null
    apt-get update
    apt-get install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin
    systemctl enable docker
    systemctl status docker
    cat /etc/docker/daemon.json 

3. 安装cri-dockerd

wget https://github.com/Mirantis/cri-dockerd/releases/download/v0.3.7/cri-dockerd-0.3.7.arm64.tgz

tar -zxvf cri-dockerd-0.3.7.arm64.tgz 

install -o root -g root -m 0755 cri-dockerd/cri-dockerd /usr/bin/cri-dockerd

cri-dockerd --version

vim /etc/systemd/system/cri-docker.service
[Unit]
Description=CRI Interface for Docker Application Container Engine
Documentation=https://docs.mirantis.com
After=network-online.target firewalld.service docker.service
Wants=network-online.target
Requires=cri-docker.socket

[Service]
Type=notify
ExecStart=/usr/local/bin/cri-dockerd --pod-infra-container-image=registry.aliyuncs.com/google_containers/pause:3.8 --container-runtime-endpoint fd:// --network-plugin=cni --cni-bin-dir=/opt/cni/bin --cni-cache-dir=/var/lib/cni/cache --cni-conf-dir=/etc/cni/net.d
ExecReload=/bin/kill -s HUP $MAINPID
TimeoutSec=0
RestartSec=2
Restart=always
StartLimitBurst=3
StartLimitInterval=60s
LimitNOFILE=infinity
LimitNPROC=infinity
LimitCORE=infinity
TasksMax=infinity
Delegate=yes
KillMode=process

[Install]
WantedBy=multi-user.target
vim /etc/systemd/system/cri-docker.socket
[Unit]
Description=CRI Docker Socket for the API
PartOf=cri-docker.service

[Socket]
ListenStream=%t/cri-dockerd.sock
SocketMode=0660
SocketUser=root
SocketGroup=docker

[Install]
WantedBy=sockets.target
systemctl daemon-reload && systemctl enable cri-docker --now && systemctl status cri-docker

4. 安装kubernetes

4.1. 安装critical & conntrack

wget https://github.com/kubernetes-sigs/cri-tools/releases/download/v1.28.0/crictl-v1.28.0-linux-arm64.tar.gz
tar -zxvf crictl-v1.28.0-linux-arm64.tar.gz 
ln -s $(pwd)/crictl /usr/bin/crictl

apt install conntrack
wget https://storage.googleapis.com/kubernetes-release/release/v1.24.7/kubernetes-server-linux-arm64.tar.gz
tar -zxvf kubernetes-server-linux-arm64.tar.gz

ln -s $(pwd)/kubernetes/server/bin/kubectl /usr/bin/kubectl
ln -s $(pwd)k8s/kubernetes/server/bin/kubeadm /usr/bin/kubeadm
ln -s $(pwd)k8s/kubernetes/server/bin/kubelet /usr/bin/kubelet

# 关闭交换区
swapoff -a

cat <<EOF > /etc/sysctl.d/k8s.conf
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
net.ipv4.ip_forward = 1
EOF
sysctl -p /etc/sysctl.d/k8s.conf
mkdir -p /etc/systemd/system/kubelet.service.d
vim /etc/systemd/system/kubelet.service 
[Unit]
Description=kubelet: The Kubernetes Node Agent
Documentation=https://kubernetes.io/docs/home/
Wants=network-online.target
After=network-online.target

[Service]
ExecStart=/usr/bin/kubelet
Restart=always
StartLimitInterval=0
RestartSec=10

[Install]
WantedBy=multi-user.target
# 主节点指定CRI
kubeadm init --kubernetes-version=v1.24.6 --service-cidr=10.1.0.0/16 --pod-network-cidr=10.244.0.0/16 --v=10 --image-repository="registry.aliyuncs.com/google_containers" --cri-socket unix:///var/run/cri-dockerd.sock


# 从节点
kubeadm join 192.168.31.66:6443 --token tv23l5.oou0arvmwf8bk7y2  --discovery-token-ca-cert-hash sha256:80d0d1454560d3a486df4ed7eaeb530feb8c72ba9d498a56b16d65cee0b6fc39 --cri-socket unix:///var/run/cri-dockerd.sock

http://www.kler.cn/a/136057.html

相关文章:

  • Unbuntu下怎么生成SSL自签证书?
  • 【C++】C++中的std::cerr详解
  • [Unity] 【VR】【游戏开发】在VR中使用New Input System获取按键值的完整教程
  • python学opencv|读取图像(十七)认识alpha通道
  • prometheus 搭建监控
  • 量子通信学习路径(一)
  • Map 和 WeakMap:JavaScript 中的键值对集合
  • EI论文程序:Adaboost-BP神经网络的回归预测算法,可作为深度学习对比预测模型,丰富实验内容,自带数据集,直接运行!
  • 数据库管理工具,你可以用Navicat,但我选DBeaver!
  • vue3 setup展示数据
  • Unity 场景烘培 ——unity Post-Processing后处理1(四)
  • ClickHouse的 MaterializeMySQL引擎
  • Linux进程通信——IPC、管道、FIFO的引入
  • 电容的耐压值是什么意思呢?
  • Midjourney绘画提示词Prompt参考学习教程
  • Mysql-复合查询
  • RuntimeError: PyPI no longer supports ‘pip search‘ (or XML-RPC search).
  • 04.webpack中css的压缩和抽离
  • ClickHouse 物化视图
  • 【mediasoup】TransportCongestionControlClient 1: 代码走读
  • Vue 2.0的源码构建
  • 负载均衡简介
  • mysql5.6 删除用户/ drop user
  • python django 小程序图书借阅源码
  • 华纳云服务器怎么清理cdn缓存?
  • SPASS-聚类和判别分析