实践环境openEuler-22.03-LTS-SP4 registry.cn-shanghai.aliyuncs.com/labring/kubernetes:v1.27.16 registry.cn-shanghai.aliyuncs.com/labring/helm:v3.8.2 registry.cn-shanghai.aliyuncs.com/labring/cilium:v1.14.4 https://github.com/labring/sealos/releases/download/v5.1.1/sealos_5.1.1_linux_amd64.tar.gz 简介Sealos是一个简单的 Golang 二进制文件,可用于快速部署Kubernetes集群
先决条件以下是一些基本的安装要求:
前置准备1、同步所有集群节点的时间 2、修改所集群节点的主机名 配置示例--设置节点 192.168.88.141的主机名 [code]# hostnamectl set-hostname 192-168-88-141
[/code]
3、 关闭防火墙 [code]# systemctl stop firewalld
# systemctl disable firewalld
[/code]
4、选择k8s集群镜像版本 浏览器打开 Registry Explorer ,可以查看 K8s 集群镜像的所有版本: 输入 ![]() 就会看到这个集群镜像的所有 tag。 Docker Hub 同理,输入
5、明确适配所选k8s版本的 6、下载 Sealos并配置 手动下载地址:https://github.com/labring/sealos/releases 注意 1、Sealos的版本需要适配k8s集群镜像版本,详情参见:集群镜像版本支持说明 2、建议使用稳定版本例如 3、master节点执行 这里选择下载二进制 [code]# wget https://github.com/labring/sealos/releases/download/v5.1.1/sealos_5.1.1_linux_amd64.tar.gz && tar -zxvf sealos_5.1.1_linux_amd64.tar.gz sealos && chmod +x sealos && mv sealos /usr/bin/
[/code]
说明:如果无法直接下载(比如在内网,无法直接访问网络),可以外网下载然后再上传服务器执行解压等操作。 参考连接:https://sealos.run/docs/k8s/quick-start/install-cli 4、master执行 [code]yum install -y socat
[/code]
解决安装过程中出现告警: 5、 安装K8S集群方式1、在线安装master节点上执行 [code]# sealos run registry.cn-shanghai.aliyuncs.com/labring/kubernetes:v1.22.17 registry.cn-shanghai.aliyuncs.com/labring/helm:v3.8.2 registry.cn-shanghai.aliyuncs.com/labring/cilium:v1.14.4 \
--masters 192.168.88.139 \
--nodes 192.168.88.140,192.168.88.141 -p testpwd@316
[/code]
注意:labring/helm 应当在 labring/cilium 之前。 参数说明:
遇到问题 实际安装过程中,遇到过安装失败的情况,错误提示如下: [code][wait-control-plane] Waiting for the kubelet to boot up the control plane as static Pods from directory "/etc/kubernetes/manifests". This can take up to 4m0s
[kubelet-check] Initial timeout of 40s passed.
Unfortunately, an error has occurred:
timed out waiting for the condition
This error is likely caused by:
- The kubelet is not running
- The kubelet is unhealthy due to a misconfiguration of the node in some way (required cgroups disabled)
If you are on a systemd-powered system, you can try to troubleshoot the error with the following commands:
- 'systemctl status kubelet'
- 'journalctl -xeu kubelet'
Additionally, a control plane component may have crashed or exited when started by the container runtime.
To troubleshoot, list all containers using your preferred container runtimes CLI.
Here is one example how you may list all Kubernetes containers running in cri-o/containerd using crictl:
- 'crictl --runtime-endpoint unix:///run/containerd/containerd.sock ps -a | grep kube | grep -v pause'
Once you have found the failing container, you can inspect its logs with:
- 'crictl --runtime-endpoint unix:///run/containerd/containerd.sock logs CONTAINERID'
error execution phase wait-control-plane: couldn't initialize a Kubernetes cluster
To see the stack trace of this error execute with --v=5 or higher
2026-01-17T02:32:51 error Applied to cluster error: failed to init masters: init master0 failed, error: exit status 1. Please clean and reinstall
Error: failed to init masters: init master0 failed, error: exit status 1. Please clean and reinstall
[/code]
查看 # systemctl status kubelet
● kubelet.service - kubelet: The Kubernetes Node Agent
Loaded: loaded (/etc/systemd/system/kubelet.service; enabled; vendor preset: disabled)
Drop-In: /etc/systemd/system/kubelet.service.d
└─10-kubeadm.conf
Active: active (running) since Sat 2026-01-17 02:17:08 CST; 5min ago
Docs: http://kubernetes.io/docs/
Process: 2221 ExecStartPre=/usr/bin/kubelet-pre-start.sh (code=exited, status=0/SUCCESS)
Main PID: 2237 (kubelet)
Tasks: 13 (limit: 15376)
Memory: 42.7M
CGroup: /system.slice/kubelet.service
└─ 2237 /usr/bin/kubelet --bootstrap-kubeconfig=/etc/kubernetes/bootstrap-kubelet.conf --kubeconfig=/etc/kubernetes/kubelet.conf --config=/var/lib/kubelet/config.yaml --container-runti>
Jan 17 02:22:32 192-168-88-139 kubelet[2237]: E0117 02:22:32.852248 2237 kubelet.go:2456] "Error getting node" err="node \"192-168-88-139\" not found"
.....
[/code]
查看kubelet系统日志,发现存在以下类似以下错误 [code]Jan 17 11:32:37 192-168-88-139 kubelet[280750]: I0117 11:32:37.489925 280750 dynamic_cafile_content.go:155] "Starting controller" name="client-ca-bundle::/etc/kubernetes/pki/ca.crt"
Jan 17 11:32:37 192-168-88-139 kubelet[280750]: E0117 11:32:37.495435 280750 certificate_manager.go:471] kubernetes.io/kube-apiserver-client-kubelet: Failed while requesting a signed certificate from the control plane: cannot create certificate signing request: Post "https://apiserver.cluster.local:6443/apis/certificates.k8s.io/v1/certificatesigningrequests": dial tcp 192.168.88.139:6443: connect: connection refused
[/code]
[code]Jan 17 11:33:51 192-168-88-139 kubelet[280750]: E0117 11:33:51.604218 280750 pod_workers.go:951] "Error syncing pod, skipping" err="failed to \"CreatePodSandbox\" for \"kube-apiserver-192-168-88-139_kube-system(7eb23211a94fd3a4a50291a818fefe89)\" with CreatePodSandboxError: \"Failed to create sandbox for pod \\\"kube-apiserver-192-168-88-139_kube-system(7eb23211a94fd3a4a50291a818fefe89)\\\": rpc error: code = Unknown desc = failed to create containerd task: failed to create shim task: OCI runtime create failed: unable to retrieve OCI runtime error (open /run/containerd/io.containerd.runtime.v2.task/k8s.io/23a20fe1613712213d8ff67507c9c81639cc6d75d63b6728682df689a0f9a970/log.json: no such file or directory): fork/exec /usr/bin/runc: exec format error: unknown\"" pod="kube-system/kube-apiserver-192-168-88-139" podUID=7eb23211a94fd3a4a50291a818fefe89
[/code]
说明:当然除了上述错误日志还有其它非关键错误日志,笔者排查后选择性忽略了。 查看文件 [code]# file /usr/bin/runc
/usr/bin/runc: ASCII text, with no line terminators
[/code]
初步断定 解决方法 先执行以下命令,清理k8s集群,然后重新运行上述安装命令, [code]# sealos reset
[/code]
安装过程中(出现 # wget https://github.com/opencontainers/runc/releases/download/v1.1.12/runc.amd64 -O /usr/bin/runc
[/code]
问题:为啥不是在运行sealos前替换呢?因为sealos会动态创建该文件,运行前替换会被覆盖。 集群安装好后,查看集群节点状态,如下发现存在非就绪状态节点 [code]# kubectl get nodes
NAME STATUS ROLES AGE VERSION
192-168-88-139 Ready control-plane,master 27m v1.22.17
192-168-88-140 NotReady [/code]
查看 kubelet 系统日志,发现存在以下关键错误日志 [code]Jan 17 12:41:32 192-168-88-139 kubelet[302969]: E0117 12:41:32.954702 302969 kuberuntime_manager.go:819] "CreatePodSandbox for pod failed" err="rpc error: code = Unknown desc = failed to setup network for sandbox \"2f60f86855778cfab8037eb27d657ff3254bc58c1ecfc206dd984cfe41978f43\": plugin type=\"cilium-cni\" failed (add): unable to connect to Cilium daemon: failed to create cilium agent client after 30.000000 seconds timeout: Get \"http://localhost/v1/config\": dial unix /var/run/cilium/cilium.sock: connect: no such file or directory\nIs the agent running?" pod="kube-system/coredns-7bdbbf6bf5-99cf4"
Jan 17 12:41:32 192-168-88-139 kubelet[302969]: E0117 12:41:32.954738 302969 pod_workers.go:951] "Error syncing pod, skipping" err="failed to \"CreatePodSandbox\" for \"coredns-7bdbbf6bf5-99cf4_kube-system(7f589667-5cac-4c4c-b993-459318dfb8bd)\" with CreatePodSandboxError: \"Failed to create sandbox for pod \\\"coredns-7bdbbf6bf5-99cf4_kube-system(7f589667-5cac-4c4c-b993-459318dfb8bd)\\\": rpc error: code = Unknown desc = failed to setup network for sandbox \\\"2f60f86855778cfab8037eb27d657ff3254bc58c1ecfc206dd984cfe41978f43\\\": plugin type=\\\"cilium-cni\\\" failed (add): unable to connect to Cilium daemon: failed to create cilium agent client after 30.000000 seconds timeout: Get \\\"http://localhost/v1/config\\\": dial unix /var/run/cilium/cilium.sock: connect: no such file or directory\\nIs the agent running?\"" pod="kube-system/coredns-7bdbbf6bf5-99cf4" podUID=7f589667-5cac-4c4c-b993-459318dfb8bd
Jan 17 12:41:34 192-168-88-139 kubelet[302969]: E0117 12:41:34.758111 302969 cadvisor_stats_provider.go:415] "Partial failure issuing cadvisor.ContainerInfoV2" err="partial failures: [\"/system.slice/kubelet.service\": RecentStats: unable to find data in memory cache]"
[/code]
根据日志分析可知 # kubectl get pods -n kube-system | grep cilium
cilium-2s77x 0/1 Init:0/6 0 34m
cilium-operator-6778f57859-ls6qn 0/1 ContainerCreating 0 34m
cilium-rqr6f 0/1 Running 8 (6m42s ago) 34m
cilium-wbjf7 0/1 Init:0/6 0 34m
[/code]
查看pod事件,发现以下错误 [code]Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal Scheduled 34m default-scheduler Successfully assigned kube-system/cilium-2s77x to 192-168-88-141
Warning FailedCreatePodSandBox 34m kubelet Failed to create pod sandbox: rpc error: code = Unknown desc = failed to create containerd task: failed to create shim task: OCI runtime create failed: unable to retrieve OCI runtime error (open /run/containerd/io.containerd.runtime.v2.task/k8s.io/655252912fe2c7336eb25a1d57e78a7bcaff2fb7a98890c11000454dd10d2b7b/log.json: no such file or directory): fork/exec /usr/bin/runc: exec format error: unknown
[/code]
解决方法:每个节点上执行以下命令,手动替换 # wget https://github.com/opencontainers/runc/releases/download/v1.1.12/runc.amd64 -O /usr/bin/runc
[/code]
然后重启 # kubectl rollout restart daemonset cilium -n kube-system
[/code]
再次检测节点状态,如下,都正常。至此集群部署成功。 [code]# kubectl get nodes
NAME STATUS ROLES AGE VERSION
192-168-88-139 Ready control-plane,master 55m v1.22.17
192-168-88-140 Ready [/code]
方式2:离线安装离线环境只需要提前导入镜像,其它步骤与在线安装一致。 kubernetes为例,首先在有网络的环境中导出集群镜像: [code]# sealos pull registry.cn-shanghai.aliyuncs.com/labring/kubernetes:v1.22.17
# sealos save -o kubernetes.tar registry.cn-shanghai.aliyuncs.com/labring/kubernetes:v1.22.17
[/code]
导入镜像并安装,将 kubernetes.tar 拷贝到离线环境,使用 load 命令导入镜像即可: [code]# sealos load -i kubernetes.tar
sealos images # 查看集群镜像是否导入成功
[/code]
剩下的安装方式与在线安装的步骤一致: [code]# run registry.cn-shanghai.aliyuncs.com/labring/kubernetes:v1.22.17 registry.cn-shanghai.aliyuncs.com/labring/helm:v3.8.2 registry.cn-shanghai.aliyuncs.com/labring/cilium:v1.14.4 \
--masters 192.168.88.139 \
--nodes 192.168.88.140,192.168.88.141 -p testpwd@316
[/code]
也可以不用 load 命令导入镜像,直接运行以下启动命令即可安装 K8s: [code]# sealos run kubernetes.tar helm.tar cilium.tar
--masters 192.168.88.139 \
--nodes 192.168.88.140,192.168.88.141 -p testpwd@316
[/code]
按需安装其它分布式应用示例: [code]sealos run registry.cn-shanghai.aliyuncs.com/labring/openebs:v3.9.0 # install openebs
sealos run registry.cn-shanghai.aliyuncs.com/labring/minio-operator:v4.5.5 registry.cn-shanghai.aliyuncs.com/labring/ingress-nginx:4.1.0
[/code]
这样Minio,openebs 等应用都有了,不用关心所有的依赖问题。 附:sealos其它功能命令简介增加 K8s 节点增加 node 节点: [code]$ sealos add --nodes 192.168.88.142,192.168.88.143
[/code]
增加 master 节点: [code]$ sealos add --masters 192.168.88.137,192.168.88.138
[/code]
删除 K8s 节点删除 node 节点: [code]$ sealos delete --nodes 192.168.88.142,192.168.88.143
[/code]
删除 master 节点:[code]$ sealos delete --masters 192.168.88.137,192.168.88.138
[/code]
清理 K8s 集群[code]$ sealos reset
[/code]
更多用法,查看命令帮助 参考链接https://sealos.run/docs/k8s/quick-start/deploy-kubernetes 来源:程序园用户自行投稿发布,如果侵权,请联系站长删除 免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作! |

三、VS Code安装 3.1安装 VS Code官网下载 https://code.visualstudio.com/ 下载好一键安装即可 四、phpstudy安装搭建网站 下载phpstudy解压安装 官网下载:https://www.xp.cn/download.html 安装完成后一键启
最近,人工智能工具OpenClaw(曾用名:Clawdbot、Moltbot)这波真的玩疯了~ 和主打对话的普通AI不同,OpenClaw不仅会独立思考,更能直接上手:查资料、整理文件、自动化跑流程、清空每日重复琐事,相当于给你配了位