Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installation script fails in Ubuntu WSL #11396

Closed
mirai-toto opened this issue Nov 28, 2024 · 4 comments
Closed

Installation script fails in Ubuntu WSL #11396

mirai-toto opened this issue Nov 28, 2024 · 4 comments

Comments

@mirai-toto
Copy link

In a new WSL instance the installation script fails immediately:

root@WindowsPC:~# curl -sfL https://get.k3s.io | sh -
[INFO]  Finding release for channel stable
[INFO]  Using v1.30.6+k3s1 as release
[INFO]  Downloading hash https://github.com/k3s-io/k3s/releases/download/v1.30.6+k3s1/sha256sum-amd64.txt
[INFO]  Skipping binary downloaded, installed k3s matches hash
[INFO]  Skipping installation of SELinux RPM
[INFO]  Skipping /usr/local/bin/kubectl symlink to k3s, already exists
[INFO]  Skipping /usr/local/bin/crictl symlink to k3s, already exists
[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]  No change detected so skipping service start

By checking the journalctl logs:

root@WindowsPC:~# journalctl -xeu k3s.service
Nov 28 21:06:35 WindowsPC k3s[4384]: time="2024-11-28T21:06:35+01:00" level=info msg="Saving cluster bootstrap data to datastore"
Nov 28 21:06:35 WindowsPC k3s[4384]: time="2024-11-28T21:06:35+01:00" level=fatal msg="starting kubernetes: preparing server: failed to normalize server token; must be in format K10<CA-HASH>::<USERNAME>:<PASSWORD> or <PASSWORD>"
Nov 28 21:06:35 WindowsPC systemd[1]: k3s.service: Main process exited, code=exited, status=1/FAILURE
░░ Subject: Unit process exited
░░ Defined-By: systemd
...

I am not trying to run multi nodes, and am only trying to use Kubernetes locally.

@cwayne18
Copy link
Member

Does WSL support systemd yet?

@brandond
Copy link
Member

brandond commented Nov 30, 2024

The installation script is NOT failing. It is succeeding, but not restarting the service because you've already installed it once with the same configuration.

[INFO] No change detected so skipping service start

Did you read the logs at all? The service is failing to start because you have an invalid token. Check your token value in the config or CLI args.

level=fatal msg="starting kubernetes: preparing server: failed to normalize server token; must be in format K10<CA-HASH>::<USERNAME>:<PASSWORD> or <PASSWORD>"

https://docs.k3s.io/cli/token#server

@github-project-automation github-project-automation bot moved this from New to Done Issue in K3s Development Nov 30, 2024
@mirai-toto
Copy link
Author

mirai-toto commented Dec 4, 2024

Thank you for your answer, In the link you have provided.

If no token is provided when starting the first server in the cluster, one is created with a random password. The server token is always written to /var/lib/rancher/k3s/server/token, in secure format.

The server token can be used to join both server and agent nodes to the cluster. Anyone with access to the server token essentially has full administrator access to the cluster. This token should be guarded carefully.

Trying to recreate a token with k3s token create will fail.

root@xxx:~# k3s token create
FATA[0000] stat /etc/rancher/k3s/k3s.yaml: no such file or directory

The k3s.yaml is not created at the startup because K3s server did not start properly.

This doesn't seem normal. Regardless, I'll take care of it myself

@mirai-toto
Copy link
Author

Found the issue, I already had a WSL instance with k3s running, meaning that the new k3s instance couldn't connect to localhost:6444

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done Issue
Development

No branches or pull requests

3 participants