WSL2 Kubernetes踩坑合集

488 阅读1分钟
  1. WSL systemd使用问题

参考下列博客Systemd support is now available in WSL。 前提是需要更新WSL自身的版本,这个我也没有搞明白怎么看WSL自身的版本号,下了个最新的了账WSL Github。具体的解决方案是在WSL里面增加或者修改文件/etc/wsl.conf,添加下列内容

[boot]
systemd=true

这个方案感觉有问题,还是别用了,出了问题从CMD登录进去把脚本删了或者重置WSL。

2.Unable to determine runtime API version: rpc error

unable to determine image API version: rpc error: code = Unavailable desc = connection error: desc = "transport: Error while dialing dial unix /var/run/containerd/containerd.sock

【k8s】kubeadm init 时报错 unknown service runtime.v1alpha2.RuntimeService

这个没有搞明白原因,不过加sudo或者rm /etc/containerd/config.toml都有可能有效。

  1. The HTTP call equal to 'curl -sSL http://localhost:10248/healthz' failed with error 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.

这个跟没有关闭系统交换区有关,实际原因不明,参考kubeadm#1893。采用下列命令可以关闭交换区。

sudo swapoff -a