首页 > 其他分享 >用kubeadm安装k8s(使用containerd作为runc)

用kubeadm安装k8s(使用containerd作为runc)

时间:2022-11-12 15:56:36浏览次数:68  
标签:-- containerd runc https root kubeadm com localhost

1、从github下载下来containerd

https://github.com/containerd/containerd/releases/tag/v1.6.8

 

2、解压并将文件直接复制进去/usr/local/bin/

tar xvf containerd-1.6.8-linux-amd64.tar.gz
cp bin/* /usr/local/bin/

 

3、添加containerd.service放进去/lib/systemd/system

 

[root@localhost ~]# cat /lib/systemd/system/containerd.service
# Copyright The containerd Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

[Unit]
Description=containerd container runtime
Documentation=https://containerd.io
After=network.target local-fs.target

[Service]
ExecStartPre=-/sbin/modprobe overlay
ExecStart=/usr/local/bin/containerd


Type=notify
Delegate=yes
KillMode=process
Restart=always
RestartSec=5
# Having non-zero Limit*s causes performance problems due to accounting overhead
# in the kernel. We recommend using cgroups to do container-local accounting.
LimitNPROC=infinity
LimitCORE=infinity
LimitNOFILE=infinity
# Comment TasksMax if your systemd version does not supports it.
# Only systemd 226 and above support this version.
TasksMax=infinity
OOMScoreAdjust=-999

[Install]
WantedBy=multi-user.target

 

 

4、创建并且修改配置文件

[root@localhost ~]# mkdir /etc/containerd
[root@localhost ~]# containerd config default >/etc/containerd/config.toml
配置镜像加速及修改sandbox:
vim /etc/containerd/config.toml
 61     sandbox_image = "registry.aliyuncs.com/google_containers/pause:3.7”
153       [plugins."io.containerd.grpc.v1.cri".registry.mirrors]
154         [plugins."io.containerd.grpc.v1.cri".registry.mirrors."docker.io"]
155            endpoint = ["https://9916w1ow.mirror.aliyuncs.com"]

 

5、启动并设置为开机自启动

[root@localhost ~]# systemctl restart containerd
[root@localhost ~]# systemctl enable containerd
[root@localhost ~]# systemctl status containerd

 

6、部署runc

https://github.com/opencontainers/runc找到下面的包下载

wget https://github.com/opencontainers/runc/releases/download/v1.1.4/runc.amd64

 

 

7、使用kubeadm安装k8s

 

从阿里镜像库https://developer.aliyun.com/mirror/进去这里找到kubernetes的yum源

[root@localhost ~]yum install -y kubelet kubeadm kubectl

调整内核参数:
[root@localhost ~]echo “net.bridge.bridge-nf-call-iptables = 1“ >>/etc/sysctl.conf
[root@localhost ~]echo “net.ipv4.ip_forward = 1 >>/etc/sysctl.conf


执行kubeadm
kubeadm init --apiserver-advertise-address=10.0.0.80 --apiserver-bind-port=6443 --kubernetes-version=v1.25.2 --pod-network-cidr=172.31.0.0/16 --service-cidr=172.32.0.0/16 --service-dns-domain=cluster.local --image-repository=registry.cn-hangzhou.aliyuncs.com/google_containers --ignore-preflight-errors=swap


当出现成功安装后根据相应的指令执行即可
 [root@localhost ~]mkdir -p $HOME/.kube
[root@localhost ~]sudo cp -i /etc/kubernetes/admin.conf [root@localhost ~]$HOME/.kube/config
  sudo chown $(id -u):$(id -g) $HOME/.kube/config

 

8、安装CNI后即可完成

https://github.com/containernetworking/plugins/releases/tag/v1.1.1

[root@localhost src]wget https://github.com/containernetworking/plugins/releases/download/v1.1.1/cni-plugins-linux-amd64-v1.1.1.tgz
[root@localhost src]# mkdir /opt/cni/bin/ -p
[root@localhost src]# tar xvf cni-plugins-linux-amd64-v1.1.1.tgz -C /opt/cni/bin/

 

标签:--,containerd,runc,https,root,kubeadm,com,localhost
From: https://www.cnblogs.com/liangdx0729/p/16883936.html

相关文章

  • 使用 Kubeadm 部署 Kubernetes(K8S) 安装 -- Ingress-Ngnix
    前置条件:使用Kubeadm部署Kubernetes(K8S)安装安装ingress-nginx组件(在master节点执行)通过ip+port号进行访问,使用Service里的NodePort实现,把端口对外暴露缺陷......
  • 使用 Kubeadm 部署 Kubernetes(K8S) 安装 -- 持久化存储(PV&PVC)
    使用Kubeadm部署Kubernetes(K8S)安装--持久化存储(NFS网络存储)NFS存在一个弊端,需要知道NFS服务器的地址,配在yaml中PV:持久化存储,对存储资源进行抽象,对外提供可......
  • 使用 Kubeadm 部署 Kubernetes(K8S) 安装 -- 持久化存储(NFS网络存储)
    使用Kubeadm部署Kubernetes(K8S)安装Volume是Pod中能够被多个容器访问的共享目录。Kubernetes的Volume定义在Pod上,它被一个Pod中的多个容器挂载到具体的......
  • 使用kubeadm+calico部署kubernetes v1.25.3
    1、环境准备主机名IP地址系统版本k8s-master01k8s-master01.wang.orgkubeapi.wang.orgkubeapi10.0.0.101Ubuntu2004k8s-master02k8s-master02.wang.o......
  • 使用kubeadm方式搭建K8S集群
     kubeadm是官方社区推出的一个用于快速部署kubernetes集群的工具。这个工具能通过两条指令完成一个kubernetes集群的部署:#创建一个Master节点kubeadminit#将一......
  • yum安装Containerd、crictl工具
    1)安装containerd参考:https://kubernetes.io/zh-cn/docs/setup/production-environment/container-runtimes/#install-and-configure-prerequisites转发IPv4并让iptab......
  • containerd 容器
    #containerd管理操作yum-yinstalllibseccomp-develwgethttps://github.com/containerd/containerd/releases/download/v1.5.7/cri-containerd-cni-1.5.7-linux-amd64.......
  • containerd和shim通信
    containerd-shim-runc-v2启动了一个ttrpcserver(类似grpc)containerd通过ttrpc和containerd-shim-runc-v2 通信来管理容器serviceTask{ rpcState(StateReques......
  • 基于kubeadm和underlay部署K8S
     1、环境准备 #所有节点执行: ​ #修改主机名 hostnamectlset-hostnamek8s-master-101 ​ #配置hosts [root@k8s-master-101~]#cat>>/etc/hosts<<EOF......
  • hive的trunc函数详解
    一、日期TRUNC函数为指定元素而截去的日期值。其具体的语法格式:TRUNC(date[,fmt])其中:date一个日期值fmt日期格式,该日期将由指定的元素格式所截去。忽略它则由最......