Commit Graph

116 Commits (b4eca61aeb833724dd0bb277bff8982e7d9ee9b7)

Author SHA1 Message Date
Joakim Roubert 80a15bebc0 install.sh: Use built-in shell functionality instead of awk
If install.sh relies on awk, install.sh malfunctions when run on a
device with a limited environment where awk is not available. This patch
replaces the use of awk with built-in shell script functionality.

Fixes: #3737
Signed-off-by: Joakim Roubert <joakim.roubert@axis.com>
2021-08-04 12:06:53 -07:00
Manuel Buil a629db023c Fail to start k3s if nm-cloud-setup is enabled
Signed-off-by: Manuel Buil <mbuil@suse.com>
2021-06-17 12:24:53 +02:00
Brad Davidson 25c2888d28 Fix shell expansion and file permission issues install.sh
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2021-05-19 19:00:31 -07:00
Brad Davidson c824c3bcc1 Add support for multiple env files for systemd unit
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2021-05-17 14:18:40 -07:00
Vegetto 64577a070d fixes #3264 - unmount CSI plugins on uninstall
Signed-off-by: angelnu <git@angelnucom>
2021-05-03 20:05:26 -07:00
Chris Kim 7a10a9971f
Add install script option to force a restart of the K3s service (#3235)
Signed-off-by: Chris Kim <oats87g@gmail.com>
2021-04-27 08:49:03 -07:00
Frederic Crozat e856ee0e4e Replace which with command -v (#3125)
Remove dependency on which binary, use shell internal equivalent.

Signed-off-by: Frederic Crozat <fcrozat@suse.com>
2021-03-31 14:16:32 -07:00
Martin Norrsken 989b21a0da Remove unit files after disabling, instead of before
Signed-off-by: Martin Norrsken <martin.norrsken@gmail.com>
2021-03-17 10:08:50 -07:00
David Nuzik c171d4bb07 Update GITHUB_URL
Signed-off-by: David Nuzik <david.nuzik@rancher.com>
2021-03-05 09:34:18 -07:00
JenTing Hsiao 57041f0239
Add codespell CI test and fix codespell error (#2740)
* Add codespell CI test
* Fix codespell error
2020-12-22 12:35:58 -08:00
Brad Davidson 15d03c5930 Fix alternate bindir logic for #2551
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2020-12-04 21:56:22 -08:00
Brian Downs a7bf00bb9d
Update uninstall script to remove mount point path after umount (#2542)
* update uninstall script to remove mount point path after umount
2020-12-04 20:17:10 -07:00
Vincent Batts eb3e4c154c
install.sh: support install on Flatcar with no args (#2551)
* install.sh: test if BIN_DIR is readonly, else use /opt

On flatcar /usr is a readonly partition, while /opt is allowed for
writing.

Signed-off-by: Vincent Batts <vbatts@kinvolk.io>

* install.sh: only warn on Flatcar about selinux

This check is a bit more explicit, but only warn about finding the rpm
installed policy when on Flatcar Container Linux

Signed-off-by: Vincent Batts <vbatts@kinvolk.io>

* Update install.sh

Co-authored-by: Brad Davidson <brad@oatmail.org>
Signed-off-by: Vincent Batts <vbatts@kinvolk.io>

Co-authored-by: Brad Davidson <brad@oatmail.org>
2020-12-04 18:19:01 -08:00
Chris Kim 25d2ce435b
Update install.sh
Change from file check to yum check for uninstall script

Co-authored-by: Jacob Blain Christen <dweomer5@gmail.com>
2020-11-17 09:08:38 -08:00
Chris Kim 66d87698fd Enhance install.sh to help with k3s upgrade and uninstall scenarios for k3s-selinux
Signed-off-by: Chris Kim <oats87g@gmail.com>
2020-11-16 13:57:07 -08:00
Chris Kim a8275838d5 Add additional conditional logic to install.sh to prevent errors on Fedora or systems when run as non-root
Signed-off-by: Chris Kim <oats87g@gmail.com>
2020-10-29 07:30:03 -07:00
Ranjib Dey dcff6e7047 remove duplicate systemd directives
Signed-off-by: Ranjib Dey ranjib@linux.com
2020-10-28 14:53:01 -07:00
Chris Kim 38109e6c9d Add auto-install capability to install.sh for k3s-selinux
Signed-off-by: Chris Kim <oats87g@gmail.com>
2020-10-27 14:22:14 -04:00
Kevin Messer 6c9f3d528a
feat(install): replace rpm by yum for setup_selinux (#1829)
It's a bad practice to install packages via rpm directly. It's better to install all packages with Yum/Dnf. It's also possible to install packages directly via an URL, which is the purpose of this PR.
2020-09-26 01:45:33 -07:00
Adam Farden 86d2e2a5f8
[systemd] really wait for network to come online (#1665)
Wants= is required to actually set the dependency on network-online.service
After= is required or k3s.service will be started at the same time as network-online.service

In network environments with slow DHCP, both are required to ensure valid network configuration for k3s

Signed-off-by: Adam Farden <adam@farden.cz>
2020-09-26 01:44:06 -07:00
Matthew Clive fc55904d82
Add network dependency to installed service file (#2210)
Adds the line `After=network-online.target` to the k3s systemd service
file. This applies the fix mentioned in
[this GH comment](https://github.com/rancher/k3s/issues/1626#issuecomment-642253812)
which I can confirm makes k3s networking survive reboot in Raspbian
Buster.

[It appears, in some docs I found](https://www.digitalocean.com/community/tutorials/understanding-systemd-units-and-unit-files)
that this is a recommended and usual way of specifying that we need the
target to be _completed_ before starting k3s. Using just the `Wants=`
directive doesn't work for this task, you have to add both directives
at once to do this. Quote:

> `Wants=`: This directive is similar to `Requires=`, but less strict.
> `Systemd` will attempt to start any units listed here when this unit
> is activated. If these units are not found or fail to start, the
> current unit will continue to function. This is the recommended way to
> configure most dependency relationships. **Again, this implies a
> parallel activation unless modified by other directives**

> [...]

> `After=`: The units listed in this directive will be started before
> starting the current unit. This does not imply a dependency
> relationship and **one must be established through the above
> directives if this is required.**

- _(Emphasis mine)_

Signed-off-by: Matthew Clive <arcticlight@arcticlight.me>
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2020-09-26 01:42:17 -07:00
Brad Davidson 5ad76043ac Replace unmount read loop with awk
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2020-09-11 10:33:37 -07:00
Brad Davidson 9ac113de4c
Merge pull request #2185 from rockholla/bugfix/2120
2120: fix issue with umount arg list too long on uninstall
2020-09-01 17:56:06 -07:00
Patrick Force 8b47ccc4d1 2120: fix issue with umount arg list too long on uninstall
Signed-off-by: Patrick Force <patrickforce@gmail.com>
2020-09-01 16:56:42 -06:00
Brad Davidson fd933c936f
Merge pull request #1847 from ericleu/patch_install.sh
update install.sh to respect K3S_TOKEN_FILE
2020-09-01 11:14:16 -07:00
Brad Davidson 0291bd770e Fix removal of /run directories
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2020-08-07 11:13:04 -07:00
Brad Davidson 9137c45cdb
Merge pull request #1614 from sen-subhabrata/master
install.sh: cleanup /run on uninstall
2020-08-05 11:26:21 -07:00
Josh McSavaney 265bd9848b Always validate K3S_URL.
Also move K3S_URL validation to its own function.

Signed-off-by: Josh McSavaney <mcsaucy@csh.rit.edu>
2020-07-23 17:21:55 -04:00
Josh McSavaney 9a5b7e2fc4 Pattern match for https check instead of grep
Signed-off-by: Josh McSavaney <mcsaucy@csh.rit.edu>
2020-06-30 12:45:35 -04:00
Josh McSavaney 12235fe733 Perform basic validation on K3S_URL in install.sh
This allows us to fail quickly if we're handed a schemeless or plain
HTTP URI, rather than having the agent barf when the systemd unit
starts. For an operator, this makes for a cleaner error up front and
clear messaging for how to fix the situation.

Signed-off-by: Josh McSavaney <mcsaucy@csh.rit.edu>
2020-06-25 20:23:28 -04:00
Serge van Ginderachter 921e11930e
Always keep restarting k3s process by openrc
When for some reason, k3s crashes, and can't startup again, e.g. when
the data backend is not available (dqlite crashed, database server is
offline, ...), on openrc systems, supervise-daemon will try to restart
it, as per supervise-daemon(8):

    respawn-max:

    Sets the maximum number of times a daemon will be respawned during
    a respawn period. If a daemon dies more than this number of times
    during a respawn period, will give up trying to respawn it and exit.
    The default is 10, and 0 means unlimited.

Setting respawn-max to 0, makes sure a k3s process on openrc systems will
keep trying to come online, even if the database backend is offline for a
longer period of time.

This aligns the openrc service configuration with the systemd
configuration, which has

    Restart=always
    RestartSec=5s
2020-06-19 10:47:59 +02:00
Eric Leu b966ad18da update install.sh to respect K3S_TOKEN_FILE 2020-05-31 14:48:10 -07:00
Craig Jellick ad4c542ad5
Merge pull request #1735 from stellirin/performance
[systemd] Add value to LimitNOFILE due to performance problems
2020-05-06 16:37:37 -07:00
omichaelis e629fd381d
Replace deprecated option
The option --no-deploy was deprecated by
0374c4f63d
and is now replaced in the install.sh documentation by --disable

Signed-off-by: omichaelis <38879457+oliviermichaelis@users.noreply.github.com>
2020-05-03 18:26:59 +02:00
Adam Farden b4335630b7 [systemd] Add value to LimitNOFILE due to performance problems
When k3s is installed on an OS with default high ulimits, performance
issues can be observed. This was discovered on CoreOS where the default
value is 1073741816. Symptoms include very slow file operations such
as installing a Rook/Ceph cluster will take ~6 hours instead of ~10 minutes.

A google search for 'container LimitNOFILE' will show that most major
projects set this already, including the (unused) containerd systemd unit
found in this repository at /vendor/github.com/containerd/containerd/containerd.service

k3OS is not affected becuasse the default there is already 1048576.

See description in coreos/fedora-coreos-tracker#329
2020-05-03 09:37:00 +02:00
Darren Shepherd 0efe2af1a7
Merge pull request #1637 from MaciejKucia/mattkucia/fix-install
install: Properly detect enabled selinux
2020-04-27 09:25:15 -07:00
Maciej Kucia cae65ae648 install: Properly detect enabled selinux 2020-04-13 12:13:50 +08:00
Erik Wilson dddbd16305 Use channel server for install script 2020-04-08 14:32:52 -07:00
sen-subhabrata 4006bb57d0
Fix for issue 1326, updated install.sh
Fix for issue 1326, added lines to delete /run/k3s and /run/flannel in create_uninstall() function.
2020-04-04 14:42:12 +05:30
Erik Wilson ce10c1f080 Check for k3s policy and provide install hints 2020-03-30 08:56:15 -07:00
Viet Hung Nguyen f741e8f9c5 Fix error when get version using Wget
GitHub now returns lowercase:

wget -SqO /dev/null https://github.com/rancher/k3s/releases/latest |& grep -i location

  location: https://github.com/rancher/k3s/releases/tag/v1.17.3+k3s1
2020-03-22 17:29:51 +07:00
Erik Wilson 5753dbd6ae
Merge branch 'master' into selinux-install 2020-03-13 09:51:36 -07:00
Erik Wilson 3410986357 Update install script for rpm install 2020-03-10 11:25:43 -07:00
Darren Shepherd 429e9d4966 Don't require selinux utils and require k3s_selinux
If you are installing k3s on a selinux enforcing system then we
required that you also install k3s_selinux RPM to put in the proper
policy.
2020-02-24 16:08:02 -07:00
William Johansson 37ebb93a77 Start cgroups service in OpenRC script
cgroups init script is present in Alpine Linux since 3.8.

Fixes #660
2020-01-26 19:28:36 +01:00
Erik Wilson 95689687c3 Add INSTALL_K3S_COMMIT option to installer 2019-12-24 09:58:43 -07:00
Johan Kok 51f8a1a0b9
Verify selinux status before downloading 2019-11-23 13:03:40 +01:00
Erik Wilson e810ee1678
Merge pull request #967 from erikwilson/killall-cleanup
Cleanup k3s-killall
2019-10-26 16:54:09 -07:00
Erik Wilson fecdee6fb5 Fix installs for older systemd 2019-10-26 16:18:45 -07:00
Erik Wilson ef9c1f23f0 Cleanup k3s-killall 2019-10-26 16:13:59 -07:00