kubernetes 服务在离线时失败(没有互联网)k3s 安装
kubernetes Service failing while offline (without internet) k3s installation
我正在尝试offline setup of k3s,即通过以下步骤 单服务器配置 没有互联网连接,但最后 k3s 服务状态是 loaded
而不是 active
和 default/kube-system
pods 不会出现。
我从 Assets and install.sh script 下载了 k3s 二进制文件,然后:
cp /home/my-ubuntu/k3s /usr/local/bin/
cd /usr/local/bin/
chmod 770 k3s
- 赋予 k3s 二进制文件可执行权限
- 将 airgap-images-amd64.tar 图片放在
/var/lib/rancher/k3s/agent/images/
mkdir /etc/rancher/k3s
cp /home/my-ubuntu/k3s.yaml /etc/rancher/k3s
- 从不同机器复制 k3s 配置文件(因为当我尝试不使用配置文件时,我无法设置导出变量(第 7 步)并且无法查看默认值 pods kubectl get all -A
)。我觉得我这一步有误,请确认。
chmod 770 /etc/rancher/k3s/k3s.yaml
export KUBECONFIG=/etc/rancher/k3s/k3s.yaml
- 设置 KUBECONFIG 环境。变量
INSTALL_K3S_SKIP_DOWNLOAD=true ./install.sh
journalctl -xe
中的错误:
-- Unit k3s.service has begun starting up.
Nov 09 19:11:51 my-ubuntu sh[14683]: + /usr/bin/systemctl is-enabled --quiet nm-cloud-setup.service
Nov 09 19:11:51 my-ubuntu sh[14683]: /bin/sh: 1: /usr/bin/systemctl: not found
Nov 09 19:11:51 my-ubuntu k3s[14695]: time="2021-11-09T19:11:51.488895919+05:30" level=fatal msg="no default routes found in \"/proc/net/route\" or \"/proc/net/ipv6_route\""
Nov 09 19:11:51 my-ubuntu systemd[1]: k3s.service: Main process exited, code=exited, status=1/FAILURE
Nov 09 19:11:51 my-ubuntu systemd[1]: k3s.service: Failed with result 'exit-code'.
Nov 09 19:11:51 my-ubuntu systemd[1]: Failed to start Lightweight Kubernetes.
-- Subject: Unit k3s.service has failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- Unit k3s.service has failed.
-- The result is RESULT.
Nov 09 19:11:56 shreya-Virtual-Machine systemd[1]: k3s.service: Service hold-off time over, scheduling restart.
Nov 09 19:11:56 shreya-Virtual-Machine systemd[1]: k3s.service: Scheduled restart job, restart counter is at 20.
-- Subject: Automatic restarting of a unit has been scheduled
PS: 在这个阶段,我将这台机器连接到互联网的那一刻,低于默认 pods 开始接受命令 kubectl get all -A
:
NAMESPACE NAME READY
kube-system metrics-server-86cbb8457f-rthkn 1/1
kube-system helm-install-traefik-crd-w6wgf 1/1
kube-system helm-install-traefik-m7lkg 1/1
kube-system svclb-traefik-x6qbc 2/2
kube-system traefik-97b44b794-98nkl 1/1
kube-system local-path-provisioner-5ff76fc89d-l8825 1/1
kube-system coredns-7448499f4d-br6tm 1/1
我的目标只是在没有互联网连接(离线)的情况下安装 k3s 并获取所有这些 pods 运行。 请告诉我我缺少什么在吗?
有一个open issue用于离线安装-需要设置默认网关。
关注this comment,它应该有效。
[aiops@7 ~]$ ip route
172.17.0.0/16 dev docker0 proto kernel scope link src 172.17.0.1
192.168.100.0/24 dev ens192 proto kernel scope link src 192.168.100.7 metric 100
sudo ip route add default via 192.168.100.1
我正在尝试offline setup of k3s,即通过以下步骤 单服务器配置 没有互联网连接,但最后 k3s 服务状态是 loaded
而不是 active
和 default/kube-system
pods 不会出现。
我从 Assets and install.sh script 下载了 k3s 二进制文件,然后:
cp /home/my-ubuntu/k3s /usr/local/bin/
cd /usr/local/bin/
chmod 770 k3s
- 赋予 k3s 二进制文件可执行权限- 将 airgap-images-amd64.tar 图片放在
/var/lib/rancher/k3s/agent/images/
mkdir /etc/rancher/k3s
cp /home/my-ubuntu/k3s.yaml /etc/rancher/k3s
- 从不同机器复制 k3s 配置文件(因为当我尝试不使用配置文件时,我无法设置导出变量(第 7 步)并且无法查看默认值 podskubectl get all -A
)。我觉得我这一步有误,请确认。chmod 770 /etc/rancher/k3s/k3s.yaml
export KUBECONFIG=/etc/rancher/k3s/k3s.yaml
- 设置 KUBECONFIG 环境。变量INSTALL_K3S_SKIP_DOWNLOAD=true ./install.sh
journalctl -xe
中的错误:
-- Unit k3s.service has begun starting up.
Nov 09 19:11:51 my-ubuntu sh[14683]: + /usr/bin/systemctl is-enabled --quiet nm-cloud-setup.service
Nov 09 19:11:51 my-ubuntu sh[14683]: /bin/sh: 1: /usr/bin/systemctl: not found
Nov 09 19:11:51 my-ubuntu k3s[14695]: time="2021-11-09T19:11:51.488895919+05:30" level=fatal msg="no default routes found in \"/proc/net/route\" or \"/proc/net/ipv6_route\""
Nov 09 19:11:51 my-ubuntu systemd[1]: k3s.service: Main process exited, code=exited, status=1/FAILURE
Nov 09 19:11:51 my-ubuntu systemd[1]: k3s.service: Failed with result 'exit-code'.
Nov 09 19:11:51 my-ubuntu systemd[1]: Failed to start Lightweight Kubernetes.
-- Subject: Unit k3s.service has failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- Unit k3s.service has failed.
-- The result is RESULT.
Nov 09 19:11:56 shreya-Virtual-Machine systemd[1]: k3s.service: Service hold-off time over, scheduling restart.
Nov 09 19:11:56 shreya-Virtual-Machine systemd[1]: k3s.service: Scheduled restart job, restart counter is at 20.
-- Subject: Automatic restarting of a unit has been scheduled
PS: 在这个阶段,我将这台机器连接到互联网的那一刻,低于默认 pods 开始接受命令 kubectl get all -A
:
NAMESPACE NAME READY
kube-system metrics-server-86cbb8457f-rthkn 1/1
kube-system helm-install-traefik-crd-w6wgf 1/1
kube-system helm-install-traefik-m7lkg 1/1
kube-system svclb-traefik-x6qbc 2/2
kube-system traefik-97b44b794-98nkl 1/1
kube-system local-path-provisioner-5ff76fc89d-l8825 1/1
kube-system coredns-7448499f4d-br6tm 1/1
我的目标只是在没有互联网连接(离线)的情况下安装 k3s 并获取所有这些 pods 运行。 请告诉我我缺少什么在吗?
有一个open issue用于离线安装-需要设置默认网关。
关注this comment,它应该有效。
[aiops@7 ~]$ ip route
172.17.0.0/16 dev docker0 proto kernel scope link src 172.17.0.1
192.168.100.0/24 dev ens192 proto kernel scope link src 192.168.100.7 metric 100
sudo ip route add default via 192.168.100.1