Skip to content

Running k0s as a service#

Sub-command k0s install allows users to easily install k0s as a service, and define its logging.

Caveats#

  • This command is strictly a helper command. It is not meant to provide a fully-automated solution, since you can run k0s in multiple, very different ways.
  • It configures your service set-up as either a worker or a server, and will have different tasks, depending on the role you pick.
  • Supported services: OpenRC & Systemd

Server setup#

This is the default mode of operation. When a server role is picked, the installer will do the following:

  • Create user accounts for the different components (see https://github.com/k0sproject/k0s/blob/main/pkg/apis/v1beta1/system.go#L6)
  • Create a service file (OpenRC/Systemd) and redirects logging to /var/log/k0s.log.
  • If the --debug flag is used, it will also pass this flag along to the service file.

Worker Setup#

  • A worker cannot run with any other user, other than root, so no special users will be created.
  • The service file will include the --token-file flag, with a value that needs to be manually changed.
  • If the --debug flag is used, it will also pass this flag along to the service file.

Single-node setup#

  • Single-node configuration can be installed with 'k0s install server --enable-worker' command.

Additional Documentation#

see: k0s install