首页 > 解决方案 > 离线安装 K3S 失败并出现错误:正在启动 kubernetes:准备服务器:构建 kine:拨号 tcp\\:未知网络 tcp\\"

问题描述

我现在在以下位置安装 k3s:

  1. 一个带有arm64的centos7;
  2. 一个mysql8.0;

我已禁用:防火墙 selinux 交换

我修改了/etc/hosts;

我已经安装了 docker-ce;

我已经下载了:

  1. https://get.k3s.io到 install.sh
  2. k3s-airgap-images-arm64.tar 到正确的地方“/var/lib/rancher/k3s/agent/images/”
  3. chmod +x k3s-arm64 并移动到“/usr/local/bin/k3s”。

我很确定mysql连接没问题。然后我使用:INSTALL_K3S_SKIP_DOWNLOAD=true INSTALL_K3S_EXEC='server --docker --datastore-endpoint="mysql://root:root@tcp(172.16.149.139:3306)/k3s "' ./install.sh

但我总是在 journalctl 中显示错误:

Nov 19 11:05:52 k3s01 systemd[1]: Starting Lightweight Kubernetes...
Nov 19 11:05:52 k3s01 k3s[16058]: time="2020-11-19T11:05:52.883415201+08:00" level=info msg="Starting k3s v1.19.3+k3s3 (0e4fbfef)"
Nov 19 11:05:52 k3s01 k3s[16058]: time="2020-11-19T11:05:52.884004317+08:00" level=fatal msg="starting kubernetes: preparing server: creating storage endpoint: building kine: dial tcp\\: unknown network tcp\\"
Nov 19 11:05:52 k3s01 systemd[1]: k3s.service: main process exited, code=exited, status=1/FAILURE
Nov 19 11:05:52 k3s01 systemd[1]: Failed to start Lightweight Kubernetes.
Nov 19 11:05:52 k3s01 systemd[1]: Unit k3s.service entered failed state.
Nov 19 11:05:52 k3s01 systemd[1]: k3s.service failed.
Nov 19 11:05:57 k3s01 systemd[1]: k3s.service holdoff time over, scheduling restart.
Nov 19 11:05:57 k3s01 systemd[1]: Stopped Lightweight Kubernetes.
Nov 19 11:05:57 k3s01 systemd[1]: Starting Lightweight Kubernetes...
Nov 19 11:05:58 k3s01 k3s[16086]: time="2020-11-19T11:05:58.341115144+08:00" level=info msg="Starting k3s v1.19.3+k3s3 (0e4fbfef)"
Nov 19 11:05:58 k3s01 k3s[16086]: time="2020-11-19T11:05:58.345448686+08:00" level=fatal msg="starting kubernetes: preparing server: creating storage endpoint: building kine: dial tcp\\: unknown network tcp\\"
Nov 19 11:05:58 k3s01 systemd[1]: k3s.service: main process exited, code=exited, status=1/FAILURE
Nov 19 11:05:58 k3s01 systemd[1]: Failed to start Lightweight Kubernetes.
Nov 19 11:05:58 k3s01 systemd[1]: Unit k3s.service entered failed state.
Nov 19 11:05:58 k3s01 systemd[1]: k3s.service failed.
Nov 19 11:06:03 k3s01 systemd[1]: k3s.service holdoff time over, scheduling restart.
Nov 19 11:06:03 k3s01 systemd[1]: Stopped Lightweight Kubernetes.
Nov 19 11:06:03 k3s01 systemd[1]: Starting Lightweight Kubernetes...
Nov 19 11:06:03 k3s01 k3s[16114]: time="2020-11-19T11:06:03.855567834+08:00" level=info msg="Starting k3s v1.19.3+k3s3 (0e4fbfef)"
Nov 19 11:06:03 k3s01 k3s[16114]: time="2020-11-19T11:06:03.856344291+08:00" level=fatal msg="starting kubernetes: preparing server: creating storage endpoint: building kine: dial tcp\\: unknown network tcp\\"
Nov 19 11:06:03 k3s01 systemd[1]: k3s.service: main process exited, code=exited, status=1/FAILURE
Nov 19 11:06:03 k3s01 systemd[1]: Failed to start Lightweight Kubernetes.
Nov 19 11:06:03 k3s01 systemd[1]: Unit k3s.service entered failed state.
Nov 19 11:06:03 k3s01 systemd[1]: k3s.service failed.
Nov 19 11:06:08 k3s01 systemd[1]: k3s.service holdoff time over, scheduling restart.
Nov 19 11:06:08 k3s01 systemd[1]: Stopped Lightweight Kubernetes.
Nov 19 11:06:08 k3s01 systemd[1]: Starting Lightweight Kubernetes...
Nov 19 11:06:09 k3s01 k3s[16142]: time="2020-11-19T11:06:09.430387037+08:00" level=info msg="Starting k3s v1.19.3+k3s3 (0e4fbfef)"
Nov 19 11:06:09 k3s01 k3s[16142]: time="2020-11-19T11:06:09.431185565+08:00" level=fatal msg="starting kubernetes: preparing server: creating storage endpoint: building kine: dial tcp\\: unknown network tcp\\"
Nov 19 11:06:09 k3s01 systemd[1]: k3s.service: main process exited, code=exited, status=1/FAILURE
Nov 19 11:06:09 k3s01 systemd[1]: Failed to start Lightweight Kubernetes.
Nov 19 11:06:09 k3s01 systemd[1]: Unit k3s.service entered failed state.
Nov 19 11:06:09 k3s01 systemd[1]: k3s.service failed.
Nov 19 11:06:14 k3s01 systemd[1]: k3s.service holdoff time over, scheduling restart.
Nov 19 11:06:14 k3s01 systemd[1]: Stopped Lightweight Kubernetes.
Nov 19 11:06:14 k3s01 systemd[1]: Starting Lightweight Kubernetes...
Nov 19 11:06:14 k3s01 k3s[16193]: time="2020-11-19T11:06:14.888534204+08:00" level=info msg="Starting k3s v1.19.3+k3s3 (0e4fbfef)"
Nov 19 11:06:14 k3s01 k3s[16193]: time="2020-11-19T11:06:14.889537923+08:00" level=fatal msg="starting kubernetes: preparing server: creating storage endpoint: building kine: dial tcp\\: unknown network tcp\\"
Nov 19 11:06:14 k3s01 systemd[1]: k3s.service: main process exited, code=exited, status=1/FAILURE
Nov 19 11:06:14 k3s01 systemd[1]: Failed to start Lightweight Kubernetes.
Nov 19 11:06:14 k3s01 systemd[1]: Unit k3s.service entered failed state.
Nov 19 11:06:14 k3s01 systemd[1]: k3s.service failed.
Nov 19 11:06:19 k3s01 systemd[1]: k3s.service holdoff time over, scheduling restart.
Nov 19 11:06:19 k3s01 systemd[1]: Stopped Lightweight Kubernetes.
Nov 19 11:06:19 k3s01 systemd[1]: Starting Lightweight Kubernetes...
Nov 19 11:06:20 k3s01 k3s[16221]: time="2020-11-19T11:06:20.442535396+08:00" level=info msg="Starting k3s v1.19.3+k3s3 (0e4fbfef)"
Nov 19 11:06:20 k3s01 k3s[16221]: time="2020-11-19T11:06:20.443421344+08:00" level=fatal msg="starting kubernetes: preparing server: creating storage endpoint: building kine: dial tcp\\: unknown network tcp\\"
Nov 19 11:06:20 k3s01 systemd[1]: k3s.service: main process exited, code=exited, status=1/FAILURE
Nov 19 11:06:20 k3s01 systemd[1]: Failed to start Lightweight Kubernetes.
Nov 19 11:06:20 k3s01 systemd[1]: Unit k3s.service entered failed state.
Nov 19 11:06:20 k3s01 systemd[1]: k3s.service failed.
Nov 19 11:06:24 k3s01 systemd[1]: Stopped Lightweight Kubernetes.
Nov 19 11:06:24 k3s01 systemd[1]: Starting Lightweight Kubernetes...
Nov 19 11:06:25 k3s01 k3s[16336]: time="2020-11-19T11:06:25.168513665+08:00" level=info msg="Starting k3s v1.19.3+k3s3 (0e4fbfef)"
Nov 19 11:06:25 k3s01 k3s[16336]: time="2020-11-19T11:06:25.168946929+08:00" level=fatal msg="starting kubernetes: preparing server: creating storage endpoint: building kine: dial tcp\\: unknown network tcp\\"
Nov 19 11:06:25 k3s01 systemd[1]: k3s.service: main process exited, code=exited, status=1/FAILURE
Nov 19 11:06:25 k3s01 systemd[1]: Failed to start Lightweight Kubernetes.
Nov 19 11:06:25 k3s01 systemd[1]: Unit k3s.service entered failed state.
Nov 19 11:06:25 k3s01 systemd[1]: k3s.service failed.
Nov 19 11:06:30 k3s01 systemd[1]: k3s.service holdoff time over, scheduling restart.
Nov 19 11:06:30 k3s01 systemd[1]: Stopped Lightweight Kubernetes.
Nov 19 11:06:30 k3s01 systemd[1]: Starting Lightweight Kubernetes...
Nov 19 11:06:30 k3s01 k3s[16363]: time="2020-11-19T11:06:30.645875517+08:00" level=info msg="Starting k3s v1.19.3+k3s3 (0e4fbfef)"
Nov 19 11:06:30 k3s01 k3s[16363]: time="2020-11-19T11:06:30.649172179+08:00" level=fatal msg="starting kubernetes: preparing server: creating storage endpoint: building kine: dial tcp\\: unknown network tcp\\"
Nov 19 11:06:30 k3s01 systemd[1]: k3s.service: main process exited, code=exited, status=1/FAILURE
Nov 19 11:06:30 k3s01 systemd[1]: Failed to start Lightweight Kubernetes.
Nov 19 11:06:30 k3s01 systemd[1]: Unit k3s.service entered failed state.
Nov 19 11:06:30 k3s01 systemd[1]: k3s.service failed.

真不知道怎么回事,求大神帮忙!!!!!!!!!

标签: kubernetesk3s

解决方案


最后,我发现我必须使用 K3S_DATASTORE_ENDPOINT='mysql://xxxxxxx' 而不是 INSTALL_K3S_EXEC='xxx --datastore-endpoint="mysql://xxxxxx"' 来避免这种情况!但我不知道到底是什么它


推荐阅读