I am trying to do offline setup of k3s i.e. without internet connectivity for Single Server Configuration by below steps, but at the end k3s service status is loaded
instead of active
and the default/kube-system
pods not coming up.
I Downloaded k3s binary from Assets and install.sh script, then:
cp /home/my-ubuntu/k3s /usr/local/bin/
cd /usr/local/bin/
chmod 770 k3s
- giving executable rights to k3s binary- placed airgap-images-amd64.tar image at
/var/lib/rancher/k3s/agent/images/
mkdir /etc/rancher/k3s
cp /home/my-ubuntu/k3s.yaml /etc/rancher/k3s
- copying k3s config file from different machine (because when I tried without config file, I cant set export variable (Step 7) & can't get to see default pods bykubectl get all -A
). I think I am mistaken at this step, please confirm.chmod 770 /etc/rancher/k3s/k3s.yaml
export KUBECONFIG=/etc/rancher/k3s/k3s.yaml
- setting KUBECONFIG env. variableINSTALL_K3S_SKIP_DOWNLOAD=true ./install.sh
Error in 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: At this stage, the moment I connect this machine to internet, below default pods started coming for command 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
My aim is simply install k3s without internet connectivity (offline) & get all these pods up running. Please let me what am I missing here?
CodePudding user response:
There is an open issue for offline installation- default gateway need to be set.
follow this comment, it should work.
[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