当前位置:   article > 正文

k8s报错_validate service connection: cri v1 runtime api is

validate service connection: cri v1 runtime api is not implemented for endpo

报错: 这个错误信息表明你的容器运行时(container runtime)没有正常运行,具体是因为CRI(容器运行时接口)v1版本的API没有为特定的端点实现。这通常发生在使用containerd作为容器运行时时。错误信息中提到的端点是

   [ERROR CRI]: container runtime is not running: output: time="2023-12-01T23:30:36+08:00" level=fatal msg="validate service connection: CRI v1 runtime API is not implemented for endpoint \"unix:///run/containerd/containerd.sock\": rpc error: code = Unimplemented desc = unknown service runtime.v1.RuntimeService"

解决:我是这么解决的

1.检查containerd服务状态:首先确保containerd服务已经启动并且运行中。你可以使用以下命令来检查服务状态:udo systemctl status containerd  没启动的话启动

2.检查配置文件:确认containerd的配置文件(通常位于/etc/containerd/config.toml)是否正确配置了CRI插件。如果没有,你可能需要启用CRI插件并指定正确的API版本。

我修改了配置文件就好了 vim /etc/containerd/config.toml

  1. disabled_plugins = []
  2. imports = []
  3. oom_score = 0
  4. plugin_dir = ""
  5. required_plugins = []
  6. root = "/var/lib/containerd"
  7. state = "/run/containerd"
  8. temp = ""
  9. version = 2
  10. [cgroup]
  11. path = ""
  12. [debug]
  13. address = ""
  14. format = ""
  15. gid = 0
  16. level = ""
  17. uid = 0
  18. [grpc]
  19. address = "/run/containerd/containerd.sock"
  20. gid = 0
  21. max_recv_message_size = 16777216
  22. max_send_message_size = 16777216
  23. tcp_address = ""
  24. tcp_tls_ca = ""
  25. tcp_tls_cert = ""
  26. tcp_tls_key = ""
  27. uid = 0
  28. [metrics]
  29. address = ""
  30. grpc_histogram = false
  31. [plugins]
  32. [plugins."io.containerd.gc.v1.scheduler"]
  33. deletion_threshold = 0
  34. mutation_threshold = 100
  35. pause_threshold = 0.02
  36. schedule_delay = "0s"
  37. startup_delay = "100ms"
  38. [plugins."io.containerd.grpc.v1.cri"]
  39. device_ownership_from_security_context = false
  40. disable_apparmor = false
  41. disable_cgroup = false
  42. disable_hugetlb_controller = true
  43. disable_proc_mount = false
  44. disable_tcp_service = true
  45. enable_selinux = false
  46. enable_tls_streaming = false
  47. enable_unprivileged_icmp = false
  48. enable_unprivileged_ports = false
  49. ignore_image_defined_volumes = false
  50. max_concurrent_downloads = 3
  51. max_container_log_line_size = 16384
  52. netns_mounts_under_state_dir = false
  53. restrict_oom_score_adj = false
  54. sandbox_image = "registry.aliyuncs.com/google_containers/pause:3.7"
  55. selinux_category_range = 1024
  56. stats_collect_period = 10
  57. stream_idle_timeout = "4h0m0s"
  58. stream_server_address = "127.0.0.1"
  59. stream_server_port = "0"
  60. systemd_cgroup = false
  61. tolerate_missing_hugetlb_controller = true
  62. unset_seccomp_profile = ""
  63. [plugins."io.containerd.grpc.v1.cri".cni]
  64. bin_dir = "/opt/cni/bin"
  65. conf_dir = "/etc/cni/net.d"
  66. conf_template = ""
  67. ip_pref = ""
  68. max_conf_num = 1
  69. [plugins."io.containerd.grpc.v1.cri".containerd]
  70. default_runtime_name = "runc"
  71. disable_snapshot_annotations = true
  72. discard_unpacked_layers = false
  73. ignore_rdt_not_enabled_errors = false
  74. no_pivot = false
  75. snapshotter = "overlayfs"
  76. [plugins."io.containerd.grpc.v1.cri".containerd.default_runtime]
  77. base_runtime_spec = ""
  78. cni_conf_dir = ""
  79. cni_max_conf_num = 0
  80. container_annotations = []
  81. pod_annotations = []
  82. privileged_without_host_devices = false
  83. runtime_engine = ""
  84. runtime_path = ""
  85. runtime_root = ""
  86. runtime_type = ""
  87. [plugins."io.containerd.grpc.v1.cri".containerd.default_runtime.options]
  88. [plugins."io.containerd.grpc.v1.cri".containerd.runtimes]
  89. [plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc]
  90. base_runtime_spec = ""
  91. cni_conf_dir = ""
  92. cni_max_conf_num = 0
  93. container_annotations = []
  94. pod_annotations = []
  95. privileged_without_host_devices = false
  96. runtime_engine = ""
  97. runtime_path = ""
  98. runtime_root = ""
  99. runtime_type = "io.containerd.runc.v2"
  100. [plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc.options]
  101. BinaryName = ""
  102. CriuImagePath = ""
  103. CriuPath = ""
  104. CriuWorkPath = ""
  105. IoGid = 0
  106. IoUid = 0
  107. NoNewKeyring = false
  108. NoPivotRoot = false
  109. Root = ""
  110. ShimCgroup = ""
  111. SystemdCgroup = true
  112. [plugins."io.containerd.grpc.v1.cri".containerd.untrusted_workload_runtime]
  113. base_runtime_spec = ""
  114. cni_conf_dir = ""
  115. cni_max_conf_num = 0
  116. container_annotations = []
  117. pod_annotations = []
  118. privileged_without_host_devices = false
  119. runtime_engine = ""
  120. runtime_path = ""
  121. runtime_root = ""
  122. runtime_type = ""
  123. [plugins."io.containerd.grpc.v1.cri".containerd.untrusted_workload_runtime.options]
  124. [plugins."io.containerd.grpc.v1.cri".image_decryption]
  125. key_model = "node"
  126. [plugins."io.containerd.grpc.v1.cri".registry]
  127. config_path = ""
  128. [plugins."io.containerd.grpc.v1.cri".registry.auths]
  129. [plugins."io.containerd.grpc.v1.cri".registry.configs]
  130. [plugins."io.containerd.grpc.v1.cri".registry.configs."192.168.40.62".tls]
  131. insecure_skip_verify = true
  132. [plugins."io.containerd.grpc.v1.cri".registry.configs."192.168.40.62".auth]
  133. username = "admin"
  134. password = "Harbor12345"
  135. [plugins."io.containerd.grpc.v1.cri".registry.headers]
  136. [plugins."io.containerd.grpc.v1.cri".registry.mirrors]
  137. [plugins."io.containerd.grpc.v1.cri".registry.mirrors."192.168.40.62"]
  138. endpoint = ["https://192.168.40.62:443"]
  139. [plugins."io.containerd.grpc.v1.cri".registry.mirrors."docker.io"]
  140. endpoint = ["https://vh3bm52y.mirror.aliyuncs.com","https://registry.docker-cn.com"]
  141. [plugins."io.containerd.grpc.v1.cri".x509_key_pair_streaming]
  142. tls_cert_file = ""
  143. tls_key_file = ""
  144. [plugins."io.containerd.internal.v1.opt"]
  145. path = "/opt/containerd"
  146. [plugins."io.containerd.internal.v1.restart"]
  147. interval = "10s"
  148. [plugins."io.containerd.internal.v1.tracing"]
  149. sampling_ratio = 1.0
  150. service_name = "containerd"
  151. [plugins."io.containerd.metadata.v1.bolt"]
  152. content_sharing_policy = "shared"
  153. [plugins."io.containerd.monitor.v1.cgroups"]
  154. no_prometheus = false
  155. [plugins."io.containerd.runtime.v1.linux"]
  156. no_shim = false
  157. runtime = "runc"
  158. runtime_root = ""
  159. shim = "containerd-shim"
  160. shim_debug = false
  161. [plugins."io.containerd.runtime.v2.task"]
  162. platforms = ["linux/amd64"]
  163. sched_core = false
  164. [plugins."io.containerd.service.v1.diff-service"]
  165. default = ["walking"]
  166. [plugins."io.containerd.service.v1.tasks-service"]
  167. rdt_config_file = ""
  168. [plugins."io.containerd.snapshotter.v1.aufs"]
  169. root_path = ""
  170. [plugins."io.containerd.snapshotter.v1.btrfs"]
  171. root_path = ""
  172. [plugins."io.containerd.snapshotter.v1.devmapper"]
  173. async_remove = false
  174. base_image_size = ""
  175. discard_blocks = false
  176. fs_options = ""
  177. fs_type = ""
  178. pool_name = ""
  179. root_path = ""
  180. [plugins."io.containerd.snapshotter.v1.native"]
  181. root_path = ""
  182. [plugins."io.containerd.snapshotter.v1.overlayfs"]
  183. root_path = ""
  184. upperdir_label = false
  185. [plugins."io.containerd.snapshotter.v1.zfs"]
  186. root_path = ""
  187. [plugins."io.containerd.tracing.processor.v1.otlp"]
  188. endpoint = ""
  189. insecure = false
  190. protocol = ""
  191. [proxy_plugins]
  192. [stream_processors]
  193. [stream_processors."io.containerd.ocicrypt.decoder.v1.tar"]
  194. accepts = ["application/vnd.oci.image.layer.v1.tar+encrypted"]
  195. args = ["--decryption-keys-path", "/etc/containerd/ocicrypt/keys"]
  196. env = ["OCICRYPT_KEYPROVIDER_CONFIG=/etc/containerd/ocicrypt/ocicrypt_keyprovider.conf"]
  197. path = "ctd-decoder"
  198. returns = "application/vnd.oci.image.layer.v1.tar"
  199. [stream_processors."io.containerd.ocicrypt.decoder.v1.tar.gzip"]
  200. accepts = ["application/vnd.oci.image.layer.v1.tar+gzip+encrypted"]
  201. args = ["--decryption-keys-path", "/etc/containerd/ocicrypt/keys"]
  202. env = ["OCICRYPT_KEYPROVIDER_CONFIG=/etc/containerd/ocicrypt/ocicrypt_keyprovider.conf"]
  203. path = "ctd-decoder"
  204. returns = "application/vnd.oci.image.layer.v1.tar+gzip"
  205. [timeouts]
  206. "io.containerd.timeout.bolt.open" = "0s"
  207. "io.containerd.timeout.shim.cleanup" = "5s"
  208. "io.containerd.timeout.shim.load" = "5s"
  209. "io.containerd.timeout.shim.shutdown" = "3s"
  210. "io.containerd.timeout.task.state" = "2s"
  211. [ttrpc]
  212. address = ""
  213. gid = 0
  214. uid = 0

重启containerd服务:在更改任何配置或更新软件包后,你需要重启containerd服务:

查看日志:查看containerd的日志可能会提供更多的信息,以帮助诊断问题。使用以下命令查看日志:journalctl -u containerd

 

在执行 kubeadm init --config=kubeadm.yaml --ignore-preflight-errors=SystemVerification 就好了

kubeadm init --config=kubeadm.yaml --ignore-preflight-errors=SystemVerification

别的解决方法有:卸载重新安装

 #kubelet 配置文件 /usr/lib/systemd/system/kubelet.service
 #重载配置 systemctl daemon-reload 
 #重新安装 kubeadm reset  
 卸载重新安装 yum  remove  -y  kubelet-1.26.0 kubeadm-1.26.0 kubectl-1.26.0
 yum  install -y kubelet-1.26.0 kubeadm-1.26.0 kubectl-1.26.0
 systemctl enable kubelet
 systemctl restart containerd
  kubeadm config print init-defaults > kubeadm.yaml
kubeadm init --config=kubeadm.yaml --ignore-preflight-errors=SystemVerification
 

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/很楠不爱3/article/detail/565613
推荐阅读
相关标签
  

闽ICP备14008679号