首页 > 其他分享 >k8s报错合集

k8s报错合集

时间:2023-12-16 16:35:47浏览次数:38  
标签:failed underlay b4ff64fd8 kubelet 报错 myserver pod k8s 合集

底层网络沙箱容器pause无法下载报错

#如出现报错,是因为底层沙箱容器pause无法下载导致出现的问题
Events:
  Type     Reason                  Age                     From           Message
  ----     ------                  ----                    ----           -------
  Warning  FailedCreatePodSandBox  2m51s                   kubelet        Failed to create pod sandbox: rpc error: code = Unknown desc = failed to set up sandbox container "3d1bfa6d85d4f6f8564afeabb38dbcd98fd747843e6baff8a3ddd8e09d16c519" network for pod "myserver-tomcat-app1-deployment-underlay-b4ff64fd8-r6j2d": networkPlugin cni failed to set up pod "myserver-tomcat-app1-deployment-underlay-b4ff64fd8-r6j2d_myserver" network: plugin type="hybridnet" failed (add): request ip return 400 failed to wait for pod myserver-tomcat-app1-deployment-underlay-b4ff64fd8-r6j2d/myserver to be coupled with ip, expect 1 and get 0
  Warning  FailedCreatePodSandBox  2m50s                   kubelet        Failed to create pod sandbox: rpc error: code = Unknown desc = failed to set up sandbox container "a95717455f40fc6ca915da95a30c68403aa9d79d6091d41d8aba4207ae0c082a" network for pod "myserver-tomcat-app1-deployment-underlay-b4ff64fd8-r6j2d": networkPlugin cni failed to set up pod "myserver-tomcat-app1-deployment-underlay-b4ff64fd8-r6j2d_myserver" network: plugin type="hybridnet" failed (add): request ip return 400 failed to wait for pod myserver-tomcat-app1-deployment-underlay-b4ff64fd8-r6j2d/myserver to be coupled with ip, expect 1 and get 0
  Warning  FailedCreatePodSandBox  2m49s                   kubelet        Failed to create pod sandbox: rpc error: code = Unknown desc = failed to set up sandbox container "ee9bacea2ded971659178d6b571141591e6b16afd2ba287d343813b0a01bd0c2" network for pod "myserver-tomcat-app1-deployment-underlay-b4ff64fd8-r6j2d": networkPlugin cni failed to set up pod "myserver-tomcat-app1-deployment-underlay-b4ff64fd8-r6j2d_myserver" network: plugin type="hybridnet" failed (add): request ip return 400 failed to wait for pod myserver-tomcat-app1-deployment-underlay-b4ff64fd8-r6j2d/myserver to be coupled with ip, expect 1 and get 0
  Warning  FailedCreatePodSandBox  2m48s                   kubelet        Failed to create pod sandbox: rpc error: code = Unknown desc = failed to set up sandbox container "205c9fea36af5c48db74fe8c225604fea0419eec06a2d129bec67c0fa2073883" network for pod "myserver-tomcat-app1-deployment-underlay-b4ff64fd8-r6j2d": networkPlugin cni failed to set up pod "myserver-tomcat-app1-deployment-underlay-b4ff64fd8-r6j2d_myserver" network: plugin type="hybridnet" failed (add): request ip return 400 failed to wait for pod myserver-tomcat-app1-deployment-underlay-b4ff64fd8-r6j2d/myserver to be coupled with ip, expect 1 and get 0
  Warning  FailedCreatePodSandBox  2m47s                   kubelet        Failed to create pod sandbox: rpc error: code = Unknown desc = failed to set up sandbox container "74e067c04f2f0b37ee6c2fc805cdb98dbd0b1113d39a507dc98cfe6c128f2683" network for pod "myserver-tomcat-app1-deployment-underlay-b4ff64fd8-r6j2d": networkPlugin cni failed to set up pod "myserver-tomcat-app1-deployment-underlay-b4ff64fd8-r6j2d_myserver" network: plugin type="hybridnet" failed (add): request ip return 400 failed to wait for pod myserver-tomcat-app1-deployment-underlay-b4ff64fd8-r6j2d/myserver to be coupled with ip, expect 1 and get 0
  Warning  FailedCreatePodSandBox  2m46s                   kubelet        Failed to create pod sandbox: rpc error: code = Unknown desc = failed to set up sandbox container "32b368d478f645836d913e7a18e1e76de61864ae9e816e6eb54f527a19859e24" network for pod "myserver-tomcat-app1-deployment-underlay-b4ff64fd8-r6j2d": networkPlugin cni failed to set up pod "myserver-tomcat-app1-deployment-underlay-b4ff64fd8-r6j2d_myserver" network: plugin type="hybridnet" failed (add): request ip return 400 failed to wait for pod myserver-tomcat-app1-deployment-underlay-b4ff64fd8-r6j2d/myserver to be coupled with ip, expect 1 and get 0
  Warning  FailedCreatePodSandBox  2m45s                   kubelet        Failed to create pod sandbox: rpc error: code = Unknown desc = failed to set up sandbox container "8061bf7c355c2156b681310cb3b661d67732dbc56d7a786d7eeb752d1542ae99" network for pod "myserver-tomcat-app1-deployment-underlay-b4ff64fd8-r6j2d": networkPlugin cni failed to set up pod "myserver-tomcat-app1-deployment-underlay-b4ff64fd8-r6j2d_myserver" network: plugin type="hybridnet" failed (add): request ip return 400 failed to wait for pod myserver-tomcat-app1-deployment-underlay-b4ff64fd8-r6j2d/myserver to be coupled with ip, expect 1 and get 0
  Warning  FailedCreatePodSandBox  2m43s                   kubelet        Failed to create pod sandbox: rpc error: code = Unknown desc = failed to set up sandbox container "5e59dd8a3def744bb49bb8c9f8733438f10c53d185dc3c2841ee795bc92e8fa9" network for pod "myserver-tomcat-app1-deployment-underlay-b4ff64fd8-r6j2d": networkPlugin cni failed to set up pod "myserver-tomcat-app1-deployment-underlay-b4ff64fd8-r6j2d_myserver" network: plugin type="hybridnet" failed (add): request ip return 400 failed to wait for pod myserver-tomcat-app1-deployment-underlay-b4ff64fd8-r6j2d/myserver to be coupled with ip, expect 1 and get 0
  Warning  FailedCreatePodSandBox  2m42s                   kubelet        Failed to create pod sandbox: rpc error: code = Unknown desc = failed to set up sandbox container "96d47ca1517051bdf48655eb2c7c5739b376be7e7251ee8546840c874ef4a7b4" network for pod "myserver-tomcat-app1-deployment-underlay-b4ff64fd8-r6j2d": networkPlugin cni failed to set up pod "myserver-tomcat-app1-deployment-underlay-b4ff64fd8-r6j2d_myserver" network: plugin type="hybridnet" failed (add): request ip return 400 failed to wait for pod myserver-tomcat-app1-deployment-underlay-b4ff64fd8-r6j2d/myserver to be coupled with ip, expect 1 and get 0
  Normal   SandboxChanged          2m39s (x12 over 2m50s)  kubelet        Pod sandbox changed, it will be killed and re-created.
  Warning  FailedCreatePodSandBox  2m38s (x4 over 2m41s)   kubelet        (combined from similar events): Failed to create pod sandbox: rpc error: code = Unknown desc = failed to set up sandbox container "fb9d0c03fed84d94d69a86f2fd2776658966e6f81abe91ac46089cfb0bf776a6" network for pod "myserver-tomcat-app1-deployment-underlay-b4ff64fd8-r6j2d": networkPlugin cni failed to set up pod "myserver-tomcat-app1-deployment-underlay-b4ff64fd8-r6j2d_myserver" network: plugin type="hybridnet" failed (add): request ip return 400 failed to wait for pod myserver-tomcat-app1-deployment-underlay-b4ff64fd8-r6j2d/myserver to be coupled with ip, expect 1 and get 0
  Warning  IPAllocationFail        8s (x16 over 2m52s)     PodController  unable to select network: unable to find underlay network for node node3, should check webhook liveness


#解决
生成containerd的配置文件
mkdir /etc/containerd -p 
生成配置文件
containerd config default > /etc/containerd/config.toml
编辑配置文件
vim /etc/containerd/config.toml
# sandbox_image = "k8s.gcr.io/pause:3.6"
改为:
sandbox_image = "registry.aliyuncs.com/google_containers/pause:3.9"
SystemdCgroup = false 改为 SystemdCgroup = true#因为使用docker这里可以不修改如果使用containerd需要修改
#重启
systemctl restart containerd
因为底层网络沙箱容器pause:3.9下载的问题使用cri-docker的underlay网络部署失败

kubeadm初始化报错

初始化报错
root@master1:~# kubeadm init --apiserver-advertise-address=10.0.0.30 --apiserver-bind-port=6443 --kubernetes-version=v1.27.6 --pod-network-cidr=10.200.0.0/16 --service-cidr=10.0.10.0/16 --service-dns-domain=cluster.local --image-repository=registry.cn-hangzhou.aliyuncs.com/google_containers --ignore-preflight-errors=swap --cri-socket unix:///var/run/cri-dockerd.sock
[init] Using Kubernetes version: v1.27.6
[preflight] Running pre-flight checks
    [WARNING Swap]: swap is enabled; production deployments should disable swap unless testing the NodeSwap feature gate of the kubelet
[preflight] Pulling images required for setting up a Kubernetes cluster

#报错信息如下
W1215 17:24:20.372975    4553 images.go:80] could not find officially supported version of etcd for Kubernetes v1.27.6, falling back to the nearest etcd version (3.5.7-0)
[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.
[kubelet-check] It seems like the kubelet isn't running or healthy.
[kubelet-check] The HTTP call equal to 'curl -sSL http://localhost:10248/healthz' failed with error: Get "http://localhost:10248/healthz": dial tcp 127.0.0.1:10248: connect: connection refused.
[kubelet-check] It seems like the kubelet isn't running or healthy.
[kubelet-check] The HTTP call equal to 'curl -sSL http://localhost:10248/healthz' failed with error: Get "http://localhost:10248/healthz": dial tcp 127.0.0.1:10248: connect: connection refused.
[kubelet-check] It seems like the kubelet isn't running or healthy.
[kubelet-check] The HTTP call equal to 'curl -sSL http://localhost:10248/healthz' failed with error: Get "http://localhost:10248/healthz": dial tcp 127.0.0.1:10248: connect: connection refused.
[kubelet-check] It seems like the kubelet isn't running or healthy.
[kubelet-check] The HTTP call equal to 'curl -sSL http://localhost:10248/healthz' failed with error: Get "http://localhost:10248/healthz": dial tcp 127.0.0.1:10248: connect: connection refused.
[kubelet-check] It seems like the kubelet isn't running or healthy.
[kubelet-check] The HTTP call equal to 'curl -sSL http://localhost:10248/healthz' failed with error: Get "http://localhost:10248/healthz": dial tcp 127.0.0.1:10248: connect: connection refused.

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 running Kubernetes containers by using crictl:
    - 'crictl --runtime-endpoint unix:///var/run/cri-dockerd.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:///var/run/cri-dockerd.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

检查kubelet

root@master1:~# journalctl -xeu kubelet
░░
░░ The job identifier is 9109.
Dec 15 17:29:38 master1 kubelet[5073]: Flag --container-runtime-endpoint has been deprecated, This parameter should be set via the config file specified by the Kubelet's --config flag. See https://kubernetes.io/docs/tasks/administer-cluster/kubelet-config-file/ for mor>
Dec 15 17:29:38 master1 kubelet[5073]: Flag --pod-infra-container-image has been deprecated, will be removed in a future release. Image garbage collector will get sandbox image information from CRI.
Dec 15 17:29:38 master1 kubelet[5073]: I1215 17:29:38.249499 5073 server.go:199] "--pod-infra-container-image will not be pruned by the image garbage collector in kubelet and should also be set in the remote runtime"
Dec 15 17:29:38 master1 kubelet[5073]: I1215 17:29:38.255491 5073 server.go:415] "Kubelet version" kubeletVersion="v1.27.2"
Dec 15 17:29:38 master1 kubelet[5073]: I1215 17:29:38.255716 5073 server.go:417] "Golang settings" GOGC="" GOMAXPROCS="" GOTRACEBACK=""
Dec 15 17:29:38 master1 kubelet[5073]: I1215 17:29:38.256157 5073 server.go:837] "Client rotation is on, will bootstrap in background"
Dec 15 17:29:38 master1 kubelet[5073]: I1215 17:29:38.258528 5073 certificate_store.go:130] Loading cert/key pair from "/var/lib/kubelet/pki/kubelet-client-current.pem".
Dec 15 17:29:38 master1 kubelet[5073]: I1215 17:29:38.260752 5073 dynamic_cafile_content.go:157] "Starting controller" name="client-ca-bundle::/etc/kubernetes/pki/ca.crt"
Dec 15 17:29:38 master1 kubelet[5073]: I1215 17:29:38.270224 5073 server.go:662] "--cgroups-per-qos enabled, but --cgroup-root was not specified. defaulting to /"
Dec 15 17:29:38 master1 kubelet[5073]: E1215 17:29:38.270459 5073 run.go:74] "command failed" err="failed to run Kubelet: running with swap on is not supported, please disable swap! or set --fail-swap-on flag to false. /proc/swaps contained: [Filename\t\t\t\tType\t\>
Dec 15 17:29:38 master1 systemd[1]: kubelet.service: Main process exited, code=exited, status=1/FAILURE

#command failed" err="failed to run Kubelet: running with swap on is not supported, please disable swap! or set --fail-swap-on flag to false. /proc/swaps

contained统计swap交换空间没有关闭

解决方法

swapoff -a

sed -ri 's/.*swap.*/#&/' /etc/fstab

 

 

标签:failed,underlay,b4ff64fd8,kubelet,报错,myserver,pod,k8s,合集
From: https://www.cnblogs.com/yeyouqing/p/17904974.html

相关文章

  • 【Nacos】启动报错 failed to req API:/nacos/v1/ns/instance after all servers([xxx
    1  com.alibaba.nacos.api.exception.NacosException:failedtoreqAPI:/nacos/v1/ns/instanceafterallservers([xxx])tried:ErrCode:403,ErrMsg:<html><body><h1>Whitelab#我的配置spring.application.name=virtuous-base-servicespring.profiles.......
  • k8s多维度自动弹性伸缩
    转自:http://www.manongjc.com/detail/63-uwchnflbwfuvynp.html时间:2022-10-22本文章向大家介绍k8s多维度自动弹性伸缩,主要内容包括一、背景、1.2k8s自动弹性伸缩功能包括、1.3HPA、1.4VPA、1.5CA、1.6三者使用场景、二、HPA、2.2原生指标、2.4自定义指标、2.5原......
  • nodejs使用sequelize vscode报错:Type 'Model<any, any, any>' is not a constructor f
    我的模型定义如下:import{Model,DataTypes}from"sequelize";//定义资源模型classRuleextendsModel{}问题:vscdoe报错:Type'Model<any,any,any>'isnotaconstructorfunctiontype.解决:这个问题可能是由于TypeScript类型定义的问题导致的。Model 是Seq......
  • 电脑时间不同步导致的上网报错:core/proxy/vmess/encoding: failed to read response h
    报错内容: 2023/12/1614:08:56[Warning][775541588]xxxxx.com/core/app/proxyman/outbound:failedtoprocessoutboundtraffic>xxxxx.com/core/proxy/vmess/outbound:connectionends>xxxxx.com/core/proxy/vmess/outbound:failedtoreadheader>xxxx......
  • 记一个坑爹的报错,不要过于信任IDE上的热部署插件
    近期处理一个老项目的安全漏洞,要求敏感数据不能明文传输,考虑到效率和兼容性等问题,决定使用对称加密,前端使用CryptoJS,后端使用Java标准库提供的API;最开始试了DES算法,可以调通,但是鉴于现在这个算法因为秘钥太短已经不安全,又尝试新的AES,但是怎么也不行,后台解密报错:java......
  • K8S 入门实战 (1)
    Docker安装#1.查看机器信息,内核版本要求3.8以上$uname-aLinuxcentos85.11.12-300.el8.aarch64#1SMPFriJul3012:03:15CST2021aarch64aarch64aarch64GNU/Linux#2.关闭selinux$setenforceEnforcing$getenforceEnforcing#3.关闭防火......
  • 解决方案 | pywintypes.com_error: (-2147221005, '无效的类字符串', None, None) --P
     1背景importpythoncomimportwin32com.clientimportmathwincad=win32com.client.Dispatch("AutoCAD.Application")#强制打开cad,该句发生报错信息doc=wincad.ActiveDocumentdoc.Utility.Prompt("Hello!Autocadfrompywin32com.\n")msp=doc.Mode......
  • K8s 里如何优雅地使用 /dev/shm 实现容器间共享内存
    目录1.从dockerrun的--shm-size参数聊起2.Linux里的/dev/shm3.Docker对共享内存的支持4.K8s里如何设置/dev/shm大小4.1方案一:修改节点的Docker配置4.2方案二:通过Volume挂载一个大目录到Pod的/dev/shm4.3方案三:用K8s的方式共享内存5.总结1.从docker......
  • vscode调试import文件报错: ModuleNotFoundError No module named 'libs'
    vscode调试python时出现import其他文件夹找不到路径的报错,需要设置正确的workingdirectory(cwd)和PYTHONPATH(env){"version":"0.2.0","configurations":[{"name":"Python:CurrentFile",&quo......
  • prometheus监控k8s集群信息(通过kubelet)
    prometheus监控k8s集群信息(通过kubelet)一、创建prometheus访问k8s权限账户(在k8s集群中操作)。1、在k8s集群中创建服务账户vimprometheus-sa.yamlapiVersion:v1kind:ServiceAccountmetadata:name:prometheus-sanamespace:monitor 2、创建集群角色......