热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

kubernetes1.24+containerd搭建

1. 安装containerdk8s1.24不支持docker作为运行时容器,需要采用containerdk8s1.24可以支持docker的远程镜像1.1. 安装apt-geti

 

1. 安装containerd

 

  k8s1.24不支持docker作为运行时容器,需要采用containerd

  k8s1.24可以支持docker的远程镜像

1.1. 安装

  apt-get install containerd.io=1.6.6-1

1.2. 生成containerd默认配置文件(所有节点)

  mv /etc/containerd/config.toml /etc/containerd/config.toml.orig

  containerd config default > /etc/containerd/config.toml

1.3. 修改config.toml文件

  • endpoint加速器

    [plugins."io.containerd.tracing.processor.v1.otlp"]

        endpoint = "https://docker.mirrors.ustc.edu.cn/"

          insecure = false

          protocol = “"

  • 修改sandbox_image

    #sandbox_image = "k8s.gcr.io/pause:3.6"

        sandbox_image = "registry.aliyuncs.com/google_containers/pause:3.7"

  • 修改Systemdcgroup

    [plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc.options]

              IoUid = 0

              NOnewKeyring= false

              NoPivotRoot = false

              Root = ""

              ShimCgroup = ""

              SystemdCgroup = true

  • 修改root和state的路径(看硬盘情况)

    required_plugins = []

    root = "/home/containerd/root"

    state = "/home/containerd/state"

    temp = ""

    version = 2

1.4. 重启containerd

  systemctl restart containerd

1.5. 查看镜像

  sudo crictl image ls

   

  • 1 node(s) had untolerated taint {node-role.kubernetes.io/control-plane: }. preemption: 0/1 nodes are available:

    kubectl taint nodes --all node-role.kubernetes.io/control-plane-

 

4.8. 日志查看

    

  systemctl status kubelet

  journalctl -xefu kubelet

  vim /var/log/pods/kube-system_kube-apiserver

 

4.9. POD网络差距flannel安装

  用来部署pod的地址

  •  下载配置:

    wget https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml

  •  修改配置文件:

    确保kube-flannel.yml的这个字段“Network”: “10.244.0.0/16" 与kubeadm.conf的podSubnet地址一致

  •  部署:

    kubectl apply -f kube-flannel.yml

  •  检测flannel进程是否启动:

    qiteck@logic:~/program/k8s_1.24.2$ ps -ef|grep flannel

    root        4673    4326  0 09:16 ?        00:00:00 /opt/bin/flanneld --ip-masq --kube-subnet-mgr

  • 检测flannel进程是否启动:
iteck@server:~$ sudo kubectl get pods -n kube-system
NAME                                         READY   STATUS    RESTARTS        AGE
coredns-74586cf9b6-8mbqz                     1/1     Running   3 (6d23h ago)   6d23h
coredns-74586cf9b6-hz48p                     1/1     Running   3 (6d23h ago)   6d23h
etcd-master.cluster.k8s                      1/1     Running   5 (6d23h ago)   6d23h
kube-apiserver-master.cluster.k8s            1/1     Running   0               3d1h
kube-controller-manager-master.cluster.k8s   1/1     Running   7 (2d23h ago)   6d23h
kube-flannel-ds-rt8z5                        1/1     Running   5 (46h ago)     3d
kube-flannel-ds-t6nrc                        1/1     Running   1 (6d23h ago)   6d23h
kube-proxy-ngnrv                             1/1     Running   5 (46h ago)     3d
kube-proxy-tjh8h                             1/1     Running   4 (6d23h ago)   6d23h
kube-scheduler-master.cluster.k8s            1/1     Running   7 (2d23h ago)   6d23h
  • 看下cni0网卡是否有了:
qiteck@server:~$ ifconfig
br-0480d1b7cefb: flags=4163  mtu 1500
        inet 172.18.0.1  netmask 255.255.0.0  broadcast 172.18.255.255
        inet6 fe80::42:e1ff:fe6e:8e3c  prefixlen 64  scopeid 0x20
        ether 02:42:e1:6e:8e:3c  txqueuelen 0  (Ethernet)
        RX packets 84662  bytes 119261797 (119.2 MB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 83663  bytes 121420317 (121.4 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

cni0: flags=4163  mtu 1450
        inet 10.244.1.1  netmask 255.255.255.0  broadcast 10.244.1.255
        inet6 fe80::b821:f2ff:fe1d:809a  prefixlen 64  scopeid 0x20
        ether ba:21:f2:1d:80:9a  txqueuelen 1000  (Ethernet)
        RX packets 9016802  bytes 993361285 (993.3 MB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 6600536  bytes 1003467886 (1.0 GB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
  • 看下是否有生成/run/flannel/subnet.env文件:

    设置flannel插件的信息, 一旦flanneld启动,它会自动将一些数据写入/run/flannel/subnet.env

 

至此,k8s主节点已经搭建起来了。


推荐阅读
author-avatar
501917112_0de975_837
这个家伙很懒,什么也没留下!
Tags | 热门标签
RankList | 热门文章
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有