centos 7 基于 containerd 运行 Kubernetes 集群

1. 安装 containerd
# yum install -y yum-utils
# yum-config-manager \
    --add-repo \
    https://download.docker.com/linux/centos/docker-ce.repo
# yum install containerd -y
2. 初始化 containerd 配置
# containerd config default > /etc/containerd/config.toml
# systemctl restart containerd
# systemctl status containerd
● containerd.service - containerd container runtime
   Loaded: loaded (/usr/lib/systemd/system/containerd.service; disabled; vendor preset: disabled)
   Active: active (running) since 六 2020-09-05 13:05:07 CST; 6s ago
     Docs: https://containerd.io
  Process: 1442 ExecStartPre=/sbin/modprobe overlay (code=exited, status=0/SUCCESS)
 Main PID: 1446 (containerd)
    Tasks: 10
   Memory: 27.3M
   CGroup: /system.slice/containerd.service
           └─1446 /usr/bin/containerd

(可选)替换 containerd 默认的 sand_box 镜像,编辑 /etc/containerd/config.toml

在这里插入图片描述

不要忘记重启 containerd 服务:

# systemctl daemon-reload
# systemctl restart containerd
3. 安装 CRI 客户端 crictl
# VERSION="v1.19.0"
# wget https://github.com/kubernetes-sigs/cri-tools/releases/download/$VERSION/crictl-$VERSION-linux-amd64.tar.gz
# sudo tar zxvf crictl-$VERSION-linux-amd64.tar.gz -C /usr/local/bin
# rm -f crictl-$VERSION-linux-amd64.tar.gz
# echo "runtime-endpoint: unix:///run/containerd/containerd.sock" > /etc/crictl.yaml

简单测试一下:

# crictl pull registry.aliyuncs.com/google_containers/pause:3.2
# crictl images
IMAGE                                           TAG                 IMAGE ID            SIZE
registry.aliyuncs.com/google_containers/pause   3.2                 80d28bedfe5de       298kB
4. 安装 kubeadm、kubelet、kubectl
# cat > /etc/yum.repos.d/k8s.repo <<EOF
[kubernetes]
name=Kubernetes
baseurl=https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64/
enabled=1
gpgcheck=1
repo_gpgcheck=1
gpgkey=https://mirrors.aliyun.com/kubernetes/yum/doc/yum-key.gpg https://mirrors.aliyun.com/kubernetes/yum/doc/rpm-package-key.gpg
exclude=kube*
EOF
# yum install kubeadm kubectl kubelet --disableexcludes=kubernetes
5. 初始化 Kubernetes 集群
# yum install libseccomp -y
# systemctl disable firewalld --now
# setenforce 0
# modprobe br_netfilter
# echo 1 > /proc/sys/net/bridge/bridge-nf-call-iptables
# echo 1 > /proc/sys/net/ipv4/ip_forward
# kubeadm init --image-repository registry.aliyuncs.com/google_containers --pod-network-cidr=192.168.0.0/16
# mkdir -p $HOME/.kube
# cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
# chown $(id -u):$(id -g) $HOME/.kube/config
# kubectl describe node

在这里插入图片描述

# crictl ps
CONTAINER ID        IMAGE               CREATED             STATE               NAME                      ATTEMPT             POD ID
67209afcd12bf       bc9c328f379ce       3 minutes ago       Running             kube-proxy                0                   4dc65e83cb1b7
0deea98b35295       cbdc8369d8b15       3 minutes ago       Running             kube-scheduler            0                   13693ead40d38
999d988fac99f       09d665d529d07       3 minutes ago       Running             kube-controller-manager   0                   b23c4829a16b5
cded56eb74720       1b74e93ece2f5       3 minutes ago       Running             kube-apiserver            0                   1764093b8d99e
2a7055b4045ce       d4ca8726196cb       3 minutes ago       Running             etcd                      0                   c20f6b5f41082
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值