This message was deleted.
# k3s
a
This message was deleted.
f
anything I am missing ?
c
sudo doesn’t pass through environment variables. don’t do that.
take the sudo out and just run sh
the script itself will sudo as necessary
👍 1
f
let me try, will share the update
this is what I am seeing now -
Copy code
k3s@atul-miniserver-k3s:~$ curl -sfL <https://get.k3s.io> | INSTALL_K3S_VERSION="1.27.7" INSTALL_K3S_EXEC="server --tls-san X.X.X.X --disable=traefik" sh -
[INFO]  Using 1.27.7 as release
[INFO]  Downloading hash <https://github.com/k3s-io/k3s/releases/download/1.27.7/sha256sum-amd64.txt>
k3s@atul-miniserver-k3s:~$
c
1.27.7
is not a valid K3s version
did you mean
v1.27.7+k3s1
?
1
f
no,
1.27.7
works but with
sudo
, seems like script is misbehaving -
Copy code
k3s@atul-miniserver-k3s:~$ curl -sfL <https://get.k3s.io> | INSTALL_K3S_VERSION="1.27.7" INSTALL_K3S_EXEC="server --tls-san X.X.X.X --disable=traefik" sudo sh -

[INFO]  Finding release for channel stable
[INFO]  Using v1.27.7+k3s2 as release
[INFO]  Downloading hash <https://github.com/k3s-io/k3s/releases/download/v1.27.7+k3s2/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, already exists
[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
k3s@atul-miniserver-k3s:~$ exit
c
it looks like its doing what it’s supposed to. what’s the problem?
[INFO] No change detected so skipping service start
you’ve reinstalled the same version with the same config so it’s not restarting the service
f
INSTALL_K3S_EXEC
script does not honour the above env when used with
sudo
, tried with
sudo sh -E -
as well, no luck If i do not pass this variable, k3s is installed successfully but again with
sudo
without
sudo
it do not do anything.
c
what makes you think its not using it
f
I have checked the cert for SAN IP ( it does not allow the IP, I am setting via --tls-san option)
c
Do you see the --tls-san arg in
/etc/systemd/system/k3s.service
? If so, then the install script is working.
f
No, It did not -
Copy code
k3s@atul-miniserver-k3s:~$ cat /etc/systemd/system/k3s.service
[Unit]
Description=Lightweight Kubernetes
Documentation=<https://k3s.io>
Wants=network-online.target
After=network-online.target

[Install]
WantedBy=multi-user.target

[Service]
Type=notify
EnvironmentFile=-/etc/default/%N
EnvironmentFile=-/etc/sysconfig/%N
EnvironmentFile=-/etc/systemd/system/k3s.service.env
KillMode=process
Delegate=yes
# Having non-zero Limit*s causes performance problems due to accounting overhead
# in the kernel. We recommend using cgroups to do container-local accounting.
LimitNOFILE=1048576
LimitNPROC=infinity
LimitCORE=infinity
TasksMax=infinity
TimeoutStartSec=0
Restart=always
RestartSec=5s
ExecStartPre=/bin/sh -xc '! /usr/bin/systemctl is-enabled --quiet nm-cloud-setup.service'
ExecStartPre=-/sbin/modprobe br_netfilter
ExecStartPre=-/sbin/modprobe overlay
ExecStart=/usr/local/bin/k3s \
    server \

k3s@atul-miniserver-k3s:~$
c
wait why are you still doing
sudo sh
Don’t do that!
Copy code
curl -sfL <https://get.k3s.io> | INSTALL_K3S_VERSION="v1.27.7+k3s1" INSTALL_K3S_EXEC="server --tls-san X.X.X.X --disable=traefik" sh -s -
f
may be this is GCP machine which is causing this shenanigans, It does not respect
sh
without
sudo
c
just do that. nothing else
why not
what happens if you run that exactly as I posted
f
will share
c
Copy code
systemd-node-1:/ # curl -sfL <https://get.k3s.io> | INSTALL_K3S_VERSION="v1.27.7+k3s1" INSTALL_K3S_EXEC="server --tls-san X.X.X.X --disable=traefik" sh -s -
[INFO]  Using v1.27.7+k3s1 as release
[INFO]  Downloading hash <https://github.com/k3s-io/k3s/releases/download/v1.27.7+k3s1/sha256sum-amd64.txt>
[INFO]  Downloading binary <https://github.com/k3s-io/k3s/releases/download/v1.27.7+k3s1/k3s>
[INFO]  Verifying binary download
[INFO]  Installing k3s to /usr/local/bin/k3s
[INFO]  Skipping installation of SELinux RPM
[INFO]  Creating /usr/local/bin/kubectl symlink to k3s
[INFO]  Creating /usr/local/bin/crictl symlink to k3s
[INFO]  Creating /usr/local/bin/ctr symlink to k3s
[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

systemd-node-1:/ # cat /etc/systemd/system/k3s.service
[Unit]
Description=Lightweight Kubernetes
Documentation=<https://k3s.io>
Wants=network-online.target
After=network-online.target

[Install]
WantedBy=multi-user.target

[Service]
Type=notify
EnvironmentFile=-/etc/default/%N
EnvironmentFile=-/etc/sysconfig/%N
EnvironmentFile=-/etc/systemd/system/k3s.service.env
KillMode=process
Delegate=yes
# Having non-zero Limit*s causes performance problems due to accounting overhead
# in the kernel. We recommend using cgroups to do container-local accounting.
LimitNOFILE=1048576
LimitNPROC=infinity
LimitCORE=infinity
TasksMax=infinity
TimeoutStartSec=0
Restart=always
RestartSec=5s
ExecStartPre=/bin/sh -xc '! /usr/bin/systemctl is-enabled --quiet nm-cloud-setup.service'
ExecStartPre=-/sbin/modprobe br_netfilter
ExecStartPre=-/sbin/modprobe overlay
ExecStart=/usr/local/bin/k3s \
    server \
	'--tls-san' \
	'X.X.X.X' \
	'--disable=traefik' \
f
sh -s
option worked, I think, we should update the github read me - https://github.com/k3s-io/k3s#quick-start---install-script
I will raise the PR
c
either should work, -s isn’t generally necessary but I do it out of habit. is
sh
on this box busybox or something?
f
I am using
GCP machine
which has
debian-12 boot image
c
what exactly happens if you don’t add -s
f
as I mentioned, somehow it did not honour the
INSTALL_K3S_EXEC
env variable
c
But it is somehow honoring the version variable? that doesn’t make any sense to me
💯 1
what do you get from
Copy code
curl -sfL <https://get.k3s.io> | INSTALL_K3S_VERSION="v1.27.7+k3s1" INSTALL_K3S_EXEC="server --tls-san X.X.X.X --disable=traefik" sh -x -