前言

记录下我安装sealos的踩坑历程,全网基本没有什么类似的可靠资料,也许是因为太小众了吧,希望能帮助到搜索到此文的人.

sealos是什么

Sealos 是以 kubernetes 为内核的云操作系统发行版, 单机操作系统如同 linux 发行版本可以在上面安装和使用各种单机应用,如 PPT,Word,Excel 等。 云操作系统只需要把这些单机应用替换成各种云应用,如数据库,对象存储,消息队列等,就很容易理解了,这些应用都是分布式高可用的。 Sealos 就是能支撑运行各种分布式应用的云操作系统。有了 Sealos 就拥有了一朵云。

主要资料参考这里介绍 | sealos 这里不做赘述

资料

架构

  • 本身资料中没有画,要么从代码中提炼
  • 阅读代码,了解设计模式和代码架构,了解基础操作和实现

安装

官方操作

  1. 4.0版本的sealos
  2. # 安装前必读
  3. 1.目前只支持root用户,不支持非rootsudo
  4. 2.目前只支持在集群内的节点执行安装命令
  5. 3.提前卸载掉已安装的docker
  6. 4.3.0版本的k8s离线包无法使用4.0版本的sealos安装
  7. 5.run命令时如果密码有特殊字符,请加英文单引号
  8. 6.离线安装示例:
  9. 4.0离线安装示例:
  10. ---
  11. # 镜像打包, 在有外网的机器上执行
  12. sealos pull labring/kubernetes:v1.24.0
  13. sealos pull labring/calico:v3.22.1
  14. sealos save -o kubernetes.tar labring/kubernetes:v1.24.0
  15. sealos save -o calico.tar labring/calico:v3.22.1
  16. ---
  17. # 加载镜像, 内网机器执行
  18. sealos load -i kubernetes.tar
  19. sealos load -i calico.tar

主机

主机 用途
10.55.10.107 计划作为sealos的安装机,以及master节点
10.55.10.106 node节点1
10.55.10.97 node节点2

可以选择打通免密,方便定位问题

  1. ssh-keygen -t rsa
  2. cat id_rsa.pub >> authorized_keys
  3. vim authorized_keys # 添加秘钥
  4. vim /etc/ssh/sshd_config # 修改允许root登录 PermitRootLogin yes
  5. systemctl restart sshd

前置检查和文件准备

  1. # 主机只有挂载的/data01磁盘支持overlay,所以注定了没法向上面官方文档给出的那么简单的就能安装完成
  2. [root@test-d-010055010107 data01]# xfs_info /data01
  3. meta-data=/dev/vdb isize=512 agcount=4, agsize=5242880 blks
  4. = sectsz=512 attr=2, projid32bit=1
  5. = crc=1 finobt=0 spinodes=0
  6. data = bsize=4096 blocks=20971520, imaxpct=25
  7. = sunit=0 swidth=0 blks
  8. naming =version 2 bsize=4096 ascii-ci=0 ftype=1
  9. log =internal bsize=4096 blocks=10240, version=2
  10. = sectsz=512 sunit=0 blks, lazy-count=1
  11. realtime =none extsz=4096 blocks=0, rtextents=0
  12. lsmod | grep -e ip_vs -e nf_conntrack_ipv4
  13. # 文件准备,从远处pull下来,然后save成镜像包
  14. ctr image import kubernetes.tar
  15. ctr image import calico.tar
  16. ctr images export calico.tar docker.io/labring/calico:v3.22.1
  17. wget https://github.com/labring/sealos/releases/download/v4.1.4/sealos_4.1.4_linux_amd64.tar.gz \
  18. && tar zxvf sealos_4.1.4_linux_amd64.tar.gz sealos && chmod +x sealos && mv sealos /usr/bin
  19. # sealos_4.1.4 和 sealos_4.1.7 在Global Flags地方有区别,并且4.1.4有bug无法完成当前主机集群的正常部署,需要使用4.1.7版本

单机安装

  1. # 遇到文件格式问题,需要指定主目录
  2. [root@test-d-010055010107 data01]# ./sealos run
  3. Error: kernel does not support overlay fs: overlay: the backing xfs filesystem is formatted without d_type support, which leads to incorrect behavior. Reformat the filesystem with ftype=1 to enable d_type support. Running without d_type is not supported.: driver not supported
  4. kernel does not support overlay fs: overlay: the backing xfs filesystem is formatted without d_type support, which leads to incorrect behavior. Reformat the filesystem with ftype=1 to enable d_type support. Running without d_type is not supported.: driver not supported
  5. # 加载镜像包有问题,需要指定镜像解包格式
  6. [root@test-d-010055010107 data01]# sealos --root /data01/ --runroot /data01/ load -i kubernetes.tar
  7. Error: loading index: open /var/tmp/oci1097864579/index.json: no such file or directory
  8. loading index: open /var/tmp/oci1097864579/index.json: no such file or directory
  9. # 常用命令
  10. mkdir /data01/sealos
  11. sealos --debug --root /data01/sealos --runroot /data01/sealos/docker load -i calico.tar -t docker-archive
  12. sealos --debug --root /data01/sealos --runroot /data01/sealos/docker load -i new-kubernetes.tar -t oci-archive
  13. sealos load --help
  14. sealos --debug --root /data01/sealos --runroot /data01/sealos/docker run localhost/labring/kuberentes:v1.24 --single # 通过镜像名有问题,这里直接用镜像id
  15. sealos --debug --root /data01/sealos --runroot /data01/sealos/docker run 133c6a0a0d5f --single
  16. # 重置安装
  17. sealos --debug --root /data01/sealos --runroot /data01/sealos/docker reset
  18. # 简化命令
  19. alias s="sealos --debug --root /data01/sealos --runroot /data01/sealos/docker "
  20. s run 133c6a0a0d5f --single
  21. [root@test-d-010055010107 sealos]# s images
  22. REPOSITORY TAG IMAGE ID CREATED SIZE
  23. docker.io/labring/kubernetes v1.24 133c6a0a0d5f 10 days ago 635 MB
  24. docker.io/labring/helm v3.8.2 1123e8b4b455 7 months ago 45.1 MB
  25. docker.io/labring/calico v3.22.1 29516dc98b4b 9 months ago 546 MB
  26. # sealos version must >= v4.1.0
  27. s reset
  28. s run 133c6a0a0d5f 1123e8b4b455 29516dc98b4b --single
  29. # 手动执行image-cri-shim启动,还是有问题,查看有报错
  30. /usr/bin/image-cri-shim -f /etc/image-cri-shim.yaml
  31. fatal failed to setup image_shim, cri/shim: failed to register image service: falling using CRI v1 image API, please using other cri support v1 CRI API
  32. fatal failed to setup image_shim, cri/shim: failed to register image service: falling using CRI v1alpha2 image API, please using other cri support v1alpha2 CRI API
  33. # 排查containerd,看到有报错信息
  34. [root@test-d-010055010107 sealos]# systemctl status containerd -l
  35. containerd.service - containerd container runtime
  36. Loaded: loaded (/etc/systemd/system/containerd.service; enabled; vendor preset: disabled)
  37. Active: active (running) since Mon 2023-03-27 17:49:48 CST; 16h ago
  38. Docs: https://containerd.io
  39. Main PID: 7077 (containerd)
  40. Memory: 13.9M
  41. CGroup: /system.slice/containerd.service
  42. └─7077 /usr/bin/containerd
  43. Mar 27 17:49:48 test-d-010055010107 systemd[1]: Starting containerd container runtime...
  44. Mar 27 17:49:48 test-d-010055010107 containerd[7077]: time="2023-03-27T17:49:48.229104592+08:00" level=warning msg="failed to load plugin io.containerd.snapshotter.v1.overlayfs" error="/var/lib/containerd/io.containerd.snapshotter.v1.overlayfs does not support d_type. If the backing filesystem is xfs, please reformat with ftype=1 to enable d_type support"
  45. Mar 27 17:49:48 test-d-010055010107 containerd[7077]: time="2023-03-27T17:49:48.229191393+08:00" level=warning msg="failed to load plugin io.containerd.snapshotter.v1.devmapper" error="devmapper not configured"
  46. Mar 27 17:49:48 test-d-010055010107 containerd[7077]: time="2023-03-27T17:49:48.229403283+08:00" level=warning msg="could not use snapshotter overlayfs in metadata plugin" error="/var/lib/containerd/io.containerd.snapshotter.v1.overlayfs does not support d_type. If the backing filesystem is xfs, please reformat with ftype=1 to enable d_type support"
  47. Mar 27 17:49:48 test-d-010055010107 containerd[7077]: time="2023-03-27T17:49:48.229420619+08:00" level=warning msg="could not use snapshotter devmapper in metadata plugin" error="devmapper not configured"
  48. Mar 27 17:49:48 test-d-010055010107 containerd[7077]: time="2023-03-27T17:49:48.238313538+08:00" level=warning msg="failed to load plugin io.containerd.grpc.v1.cri" error="failed to create CRI service: failed to find snapshotter \"overlayfs\""
  49. Mar 27 17:49:48 test-d-010055010107 systemd[1]: Started containerd container runtime.
  50. # 怀疑是 containerd 没有安装成功,尝试安装crictl命令来看看
  51. tar zxvf crictl-v1.25.0-linux-amd6.tar.gz -C /usr/local/bin
  52. # 查看信息,确定是这个问题,尝试修复
  53. [root@test-d-010055010107 sealos]# crictl info
  54. E0328 10:07:11.802780 10291 remote_runtime.go:948] "Status from runtime service failed" err="rpc error: code = Unimplemented desc = unknown service runtime.v1alpha2.RuntimeService"
  55. FATA[0000] getting status of runtime: rpc error: code = Unimplemented desc = unknown service runtime.v1alpha2.RuntimeService
  56. # 查看containerd关于overlayfs的配置,以及修改目录
  57. cp -r /var/lib/container* /data01/
  58. vim /etc/containerd/config.toml 修改 root = "/data01/containerd"
  59. # 顺利启动containerd和image-cri-shim
  60. systemctl restart containerd
  61. systemctl restart image-cri-shim
  62. # 遇到了 /root/.sealos/default/etc/admin.conf 找不到的问题,看着issue需要升级到4.1.7版本,问题解决但又然后发现重复安装有问题,无法继续上次安装
  63. s reset # 重新开始
  64. # 但是安装出来的containerd还是在/var/lib/containerd,需要找到改变此路径的方法,翻阅文档猜测指定criData环境变量可能有用
  65. # 改变命令
  66. s run 133c6a0a0d5f --single --env criData=/data01/containerd
  67. # 的确有用,会把containerd安装到/data01/containerd,但是/root/.sealos/default/Clusterfile中显示的criData还是/var/lib/containerd
  68. # 成功安装
  69. # 但是节点一直未就绪
  70. [root@test-d-010055010107 sealos]# kubectl get node
  71. NAME STATUS ROLES AGE VERSION
  72. test-d-010055010107 NotReady control-plane 8m56s v1.24.0
  73. KubeletNotReady container runtime network not ready: NetworkReady=false reason:NetworkPluginNotReady message:Network plugin returns error: cni plugin not initialized
  74. [root@test-d-010055010107 sealos]# crictl ps -a
  75. CONTAINER IMAGE CREATED STATE NAME ATTEMPT POD ID POD
  76. 5d3572591a876 77b49675beae1 12 minutes ago Running kube-proxy 0 dc61529f47415 kube-proxy-vjjqv
  77. 9559b3a7d80ec aebe758cef4cd 12 minutes ago Running etcd 0 1a1846fb97f25 etcd-test-d-010055010107
  78. 00a5f23d7d227 529072250ccc6 12 minutes ago Running kube-apiserver 0 b65e60cdc8996 kube-apiserver-test-d-010055010107
  79. 91b737d89b72e e3ed7dee73e93 12 minutes ago Running kube-scheduler 0 e682c3fb7cc11 kube-scheduler-test-d-010055010107
  80. dd3a2ea10b7c7 88784fb4ac2f6 12 minutes ago Running kube-controller-manager 0 d3177bd65479c kube-controller-manager-test-d-010055010107
  81. [root@test-d-010055010107 sealos]# kubectl get pod -A
  82. NAMESPACE NAME READY STATUS RESTARTS AGE
  83. kube-system coredns-6d4b75cb6d-qfnf5 0/1 Pending 0 3h24m
  84. kube-system coredns-6d4b75cb6d-xzjz5 0/1 Pending 0 3h24m
  85. kube-system etcd-test-d-010055010107 1/1 Running 0 3h24m
  86. kube-system kube-apiserver-test-d-010055010107 1/1 Running 0 3h24m
  87. kube-system kube-controller-manager-test-d-010055010107 1/1 Running 0 3h24m
  88. kube-system kube-proxy-vjjqv 1/1 Running 0 3h24m
  89. kube-system kube-scheduler-test-d-010055010107 1/1 Running 0 3h24m
  90. [root@test-d-010055010107 sealos]# journalctl -xeu kubelet
  91. Mar 28 11:43:40 test-d-010055010107 kubelet[20385]: E0328 11:43:40.678552 20385 kubelet.go:2344] "Container runtime network not ready" networkReady="NetworkReady=f
  92. Mar 28 11:43:45 test-d-010055010107 kubelet[20385]: E0328 11:43:45.679314 20385 kubelet.go:2344] "Container runtime network not ready" networkReady="NetworkReady=f
  93. # 看issue上是说没有安装calico导致的,重新安装
  94. s reset # 并不会删除/root/.sealos
  95. s run 133c6a0a0d5f 1123e8b4b455 29516dc98b4b --single --env criData=/data01/containerd
  96. # 看着一切正常
  97. [root@test-d-010055010107 sealos]# kubectl get pod -A
  98. NAMESPACE NAME READY STATUS RESTARTS AGE
  99. calico-system calico-kube-controllers-6b44b54755-qsmkl 0/1 Pending 0 115s
  100. calico-system calico-node-7grz7 1/1 Running 0 115s
  101. calico-system calico-typha-6f9598cfd9-2sr27 1/1 Running 0 115s
  102. kube-system coredns-6d4b75cb6d-6fncr 1/1 Running 0 2m2s
  103. kube-system coredns-6d4b75cb6d-b8czk 1/1 Running 0 2m2s
  104. kube-system etcd-test-d-010055010107 1/1 Running 1 2m16s
  105. kube-system kube-apiserver-test-d-010055010107 1/1 Running 1 2m18s
  106. kube-system kube-controller-manager-test-d-010055010107 1/1 Running 1 2m16s
  107. kube-system kube-proxy-wnp2g 1/1 Running 0 2m3s
  108. kube-system kube-scheduler-test-d-010055010107 1/1 Running 1 2m16s
  109. tigera-operator tigera-operator-d7957f5cc-5wfc4 1/1 Running 0 2m2s
  110. [root@test-d-010055010107 sealos]#
  111. [root@test-d-010055010107 sealos]#
  112. [root@test-d-010055010107 sealos]# kubectl get node
  113. NAME STATUS ROLES AGE VERSION
  114. test-d-010055010107 Ready control-plane 2m25s v1.24.0

集群安装

有了单机安装的经验,该踩的坑都踩了,直接开始安装集群

  1. # 尝试集群安装
  2. alias s="sealos --debug --root /data01/sealos --runroot /data01/sealos/docker "
  3. s run 133c6a0a0d5f 1123e8b4b455 29516dc98b4b -e defaultVIP=10.55.10.108 -e criData=/data01/containerd --masters 10.55.10.107 --nodes 10.55.10.97,10.55.10.106 --passwd 112233
  4. passwd 112233
  5. [root@test-d-010055010107 ~]# kubectl get node -o wide
  6. NAME STATUS ROLES AGE VERSION INTERNAL-IP EXTERNAL-IP OS-IMAGE KERNEL-VERSION CONTAINER-RUNTIME
  7. test-d-010055010097 Ready <none> 65s v1.24.0 10.55.10.97 <none> CentOS Linux 7 (Core) 3.10.0-693.11.6.el7.x86_64 containerd://1.7.0
  8. test-d-010055010106 Ready <none> 76s v1.24.0 10.55.10.106 <none> CentOS Linux 7 (Core) 3.10.0-693.11.6.el7.x86_64 containerd://1.7.0
  9. test-d-010055010107 Ready control-plane 95s v1.24.0 10.55.10.107 <none> CentOS Linux 7 (Core) 3.10.0-693.11.6.el7.x86_64 containerd://1.7.0
  10. # 看着没啥问题

解决问题用到的参考连接

感想

  • 版本变化多,命令参数有改动,bug隐藏的深
  • 需要耐心抽丝剥茧的排查遇到的问题,可以提前安装些k8s定位问题依赖的命令如ctr/crictl
  • 也加入了官方的钉钉群,但基本不答复问题和咨询
  • 关注issue,也是唯一有价值的参考资料了
  • 禁止转载

sealos踩坑记录的更多相关文章

  1. unionId突然不能获取的踩坑记录

    昨天(2016-2-2日),突然发现系统的一个微信接口使用不了了.后来经查发现,是在网页授权获取用户基本信息的时候,unionid获取失败导致的. 在网页授权获取用户基本信息的介绍中(http://m ...

  2. CentOS7.4安装MySQL踩坑记录

    CentOS7.4安装MySQL踩坑记录 time: 2018.3.19 CentOS7.4安装MySQL时网上的文档虽然多但是不靠谱的也多, 可能因为版本与时间的问题, 所以记录下自己踩坑的过程, ...

  3. ubuntu 下安装docker 踩坑记录

    ubuntu 下安装docker 踩坑记录 # Setp : 移除旧版本Docker sudo apt-get remove docker docker-engine docker.io # Step ...

  4. SpringBoot + Shiro + shiro.ini 的踩坑记录

    0.写在前面的话 好久没写博客了,诶,好多时候偷懒直接就抓网上的资料丢笔记里了,也就没有自己提炼,偷懒偷懒.然后最近参加了一个网络课程,要交作业的那种,为了能方便看下其他同学的作业,就写了个爬虫把作业 ...

  5. 你真的了解字典(Dictionary)吗? C# Memory Cache 踩坑记录 .net 泛型 结构化CSS设计思维 WinForm POST上传与后台接收 高效实用的.NET开源项目 .net 笔试面试总结(3) .net 笔试面试总结(2) 依赖注入 C# RSA 加密 C#与Java AES 加密解密

    你真的了解字典(Dictionary)吗?   从一道亲身经历的面试题说起 半年前,我参加我现在所在公司的面试,面试官给了一道题,说有一个Y形的链表,知道起始节点,找出交叉节点.为了便于描述,我把上面 ...

  6. google nmt 实验踩坑记录

       最近因为要做一个title压缩的任务,所以调研了一些text summary的方法.    text summary 一般分为抽取式和生成式两种.前者一般是从原始的文本中抽取出重要的word o ...

  7. ABP框架踩坑记录

    ABP框架踩坑记录 ASP.NET Boilerplate是一个专用于现代Web应用程序的通用应用程序框架. 它使用了你已经熟悉的工具,并根据它们实现最佳实践. 文章目录 使用MySQL 配置User ...

  8. SpringBoot+SpringSecurity+Thymeleaf认证失败返回错误信息踩坑记录

    Spring boot +Spring Security + Thymeleaf认证失败返回错误信息踩坑记录 步入8102年,现在企业开发追求快速,Springboot以多种优秀特性引领潮流,在众多使 ...

  9. IDFA踩坑记录

    IDFA踩坑记录: 1.iOS10.0 以下,即使打开“限制广告跟踪”,依然可以读取idfa: 2.打开“限制广告跟踪”,然后再关闭“限制广告跟踪”,idfa会改变: 3.越狱机器安装开发证书打的包, ...

  10. 复杂业务下向Mysql导入30万条数据代码优化的踩坑记录

    从毕业到现在第一次接触到超过30万条数据导入MySQL的场景(有点low),就是在顺丰公司接入我司EMM产品时需要将AD中的员工数据导入MySQL中,因此楼主负责的模块connector就派上了用场. ...

随机推荐

  1. c++学习 5 预处理

    一 内存分区 内存的分区变量存储,一般可以分为以下五个区,它们分别是: 可读可写     堆区:使用malloc.calloc.realloc.free以及c++里面的new和delete去动态申请. ...

  2. sscms自己从数据库筛选内容

    where条件除了SiteId和ChannelId之外, 还需要加上IsChecked='True',而不是CheckedLevel

  3. mysql 的小问题

    首先按下win+R 执行 services.msc 进入服务,查找到MySQL,点击停止服务,然后在控制台cmd进入本地的MySQL文件夹,我的文件名是mysql-8.0.26-winx64,进入后执 ...

  4. python 创建虚拟环境python –m venv方式

    1.环境准备 1.1.刷新包清单 sudo yum update 1.2.安装SCL实用程序 sudo yum install centos-release-scl 1.3.安装Python 3.6 ...

  5. Python + Selenium + Microsoft Edge浏览器运行环境搭建及配置无界面模式

    介绍 在python中用selenium驱动Microsoft Edge(Chromium版)浏览器,并设置headless模式,也可以参考微软官方指导文档,更全更清晰 安装selenium 可以通过 ...

  6. C#.NET系列●接口抽象类

    一.接口基本概念 (1)接口:是把公共方法和属性组合起来,以封装特定功能的一个集合.创建接口时,一般一大写的I开头,接口中的成员都是公有的. 接口定义如下: interface IClown //写一 ...

  7. Java (新)将Excel数据读取到ListMap

    Java (新)将Excel数据读取到ListMap Maven依赖: pom.xml <!-- excel --> <dependency> <groupId>o ...

  8. java输入一个字符串,要求将该字符串中出现的英文字母, * 按照顺序输出,区分大小写,且大写优先

    public static void main(String[] args) { String input ="A8r4c5jaAjp#7"; //转为char[] char[] ...

  9. html超链接相关代码

    1. <IDOCTYPE html>< html><head><title>图像和超链接</title><meta http-equi ...

  10. 第一天1h

    //摄氏度和华氏度之间的换算//20211120//ZhangWenjing#include<stdio.h>int main(void){ int f = 0; int c = 0; s ...