k3s-io / k3s

Lightweight Kubernetes
https://k3s.io
Apache License 2.0
28.1k stars 2.35k forks source link

Air-Gap(Offline) install k3s cluster, K3s starts abnormally in master #2415

Closed ghost closed 3 years ago

ghost commented 4 years ago

Environmental Info: K3s Version: v1.18.9

Node(s) CPU architecture, OS, and Version:

OS:Ubuntu 18.04.3 LTS x86_64bit

Cluster Configuration:

3masters,3workers Describe the bug:

Refer to The Official documents Air-Gap Install K3s cluster,The database uses external mysql,use docker instead of containerd. code:

INSTALL_K3S_SKIP_DOWNLOAD=true INSTALL_K3S_EXEC='server --datastore-endpoint="mysql://username:password@tcp(hostname:3306)/database-name"  --docker' ./install.sh

error:

root@k3k-master1:~# INSTALL_K3S_SKIP_DOWNLOAD=true INSTALL_K3S_EXEC='server --datastore-endpoint="mysql://xxx:xxx@tcp(x.x.x.x:3306)/k3sdb" --docker' ./install.sh
[INFO]  Skipping k3s download and verify
[INFO]  Creating /usr/local/bin/kubectl symlink to k3s
[INFO]  Creating /usr/local/bin/crictl symlink to k3s
[INFO]  Skipping /usr/local/bin/ctr symlink to k3s, command exists in PATH at /usr/bin/ctr
[INFO]  Creating killall script /usr/local/bin/k3s-killall.sh
[INFO]  Creating uninstall script /usr/local/bin/k3s-uninstall.sh
[INFO]  env: Creating environment file /etc/systemd/system/k3s.service.env
[INFO]  systemd: Creating service file /etc/systemd/system/k3s.service
[INFO]  systemd: Enabling k3s unit
Created symlink /etc/systemd/system/multi-user.target.wants/k3s.service → /etc/systemd/system/k3s.service.
[INFO]  systemd: Starting k3s
Job for k3s.service failed because the control process exited with error code.
See "systemctl status k3s.service" and "journalctl -xe" for details.
root@k3k-master1:~# systemctl status k3s.service 
● k3s.service - Lightweight Kubernetes
   Loaded: loaded (/etc/systemd/system/k3s.service; enabled; vendor preset: enabled)
   Active: activating (auto-restart) (Result: exit-code) since Thu 2020-10-22 03:08:32 UTC; 4s ago
     Docs: https://k3s.io
  Process: 20686 ExecStart=/usr/local/bin/k3s server --datastore-endpoint=mysql://xxx:xxx@tcp\(x.x.x.x:3306\)/k3sdb --docker (code=exited, status=1/FAILURE)
  Process: 20682 ExecStartPre=/sbin/modprobe overlay (code=exited, status=0/SUCCESS)
  Process: 20676 ExecStartPre=/sbin/modprobe br_netfilter (code=exited, status=0/SUCCESS)
 Main PID: 20686 (code=exited, status=1/FAILURE)

Steps To Reproduce:

Expected behavior:

root@k3k-master1:~/cert# systemctl status k3s.service  | grep Active
   Active: active (running) since Thu 2020-10-22 03:13:15 UTC; 3h 5min ago

Actual behavior:

root@k3k-master1:~/cert# systemctl status k3s.service  | grep Active
   Active: activating (auto-restart) (Result: exit-code) since Thu 2020-10-22 03:08:32 UTC; 4s ago

Additional context / logs:

Temporary solution

root@k3k-master1:~/cert# tail -n 5 /etc/systemd/system/k3s.service
    server \
    '--datastore-endpoint=mysql://xxx:xxx@tcp\(x.x.x.x:3306\)/k3sdb' \
    '--docker' \

Update to

    server \
    '--datastore-endpoint=mysql://xxx:xxx@tcp(x.x.x.x::3306)/k3ssb' \
    '--docker' \

restart k3s

root@k3k-master1:~# systemctl daemon-reload  &&  systemctl restart k3s

Does anyone encounter this problem, and does it need to be modified install.sh?

brandond commented 3 years ago

Are you still experiencing this issue? I have never had any problems with the install script mangling the database connection string.

stale[bot] commented 3 years ago

This repository uses a bot to automatically label issues which have not had any activity (commit/comment/label) for 180 days. This helps us manage the community issues better. If the issue is still relevant, please add a comment to the issue so the bot can remove the label and we know it is still valid. If it is no longer relevant (or possibly fixed in the latest release), the bot will automatically close the issue in 14 days. Thank you for your contributions.