Install k3os on an instance in OpenStack

In this tutorial, you will learn how to set up an instance with k3os with the rescue mode of OpenStack

To install a minimal k3s lightweight Kubernetes on OpenStack with k3os it's required to use the rescue mode to get this working on an ephemeral instance with the iso. When using the rescue mode to install k3os the existing data will be ereased.

Prerequisites:

Step 1: Create an instance with a dummy image

For step 1,  we will create an instance with a dummy image, this image will be ereased when installing k3os!

Go into the dashboard -> compute -> instances and create a new instance with the following:

  • Ephemeral storage
  • Any image you like
  • The flavor of your taste (the flavor will limit your ephemeral storage size)
  • Name: k3os

Step 2: Upload k3os to your private image store

Go into the dashboard -> storage -> images and create a new image

  • Name: k3os-amd64
Wait till it is uploaded (a notification will pop up)

Step 3: Attach the live iso (k3os) to the instance in rescue mode

For this step, it is important to have the OpenStack CLI working.

Find the server id/name with:

$ openstack server list \
--column ID \
--column Name \
--column Status \
--column Image \
--column Flavor
+-----+--------------+--------+------------------+-----------+
| ID | Name | Status | Image | Flavor |
+-----+--------------+--------+------------------+-----------+
| xxx | k3os | ACTIVE | Ubuntu 20.04 LTS | c3.medium | -> this one
| xxx | test | ACTIVE | Ubuntu 20.04 LTS | c3.medium |
+-----+--------------+--------+------------------+-----------+

Find the image id/name with:

$ openstack image list \
--column ID \
--column Name \
--column Status \
+-----+--------------+--------+
| ID | Name | Status |
+-----+--------------+--------+
| xxx | CentOS | ACTIVE |
| xxx | Ubuntu | ACTIVE |
| xxx | Fedora | ACTIVE |
| xxx | k3os-amd64 | ACTIVE | -> this one
+-----+--------------+--------+

Set the instance into rescue mode with the k3os iso:

$ openstack server rescue k3os --image k3os-amd64

Step 4: Install k3os through the dashboard terminal

Go into the dashboard -> compute -> instances and select the three dots on the "k3os" instance we created. Select "Show console".

When the k3os has booted up in the terminal:

- Log in with: rancher
- Sudo k3os install
- Choose operation: 1. Install to disk
- Choose device: 2. vdb
- With cloud-init: (optional) else N
    - y: select local file (this has to be on the system) or http url
    - n
        - GitHub users: y/N
        - Password: <password>
        - Retype password: <password>
        - Wifi: N
        - Server or agent: 1. Server
        - Token / cluster secret: (optional) <secret>
        - Your disk will be formatted .. : y

Wait till the installation is finished. The server will reboot and try to go into the k3os installer again, don’t be fooled by this as we just installed it to the disk ;)

Step 5: Remove the live iso from the instance

To get the server in operational mode again go back into the OpenStack CLI and run

$ openstack server unrescue k3os

Conclusion

In this tutorial, you’ve learned how to set up an instance with k3os to run k3s lightweight Kubernetes.

More tutorials about using the Command Line Interface can be found here.