-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
📖 Add examples and bundles section (#618)
* 📖 Add examples Signed-off-by: mudler <[email protected]> * 📖 Add Bundles docs Signed-off-by: mudler <[email protected]> * 📖 Update config reference for p2p block Signed-off-by: mudler <[email protected]> * 📖 Add Fedora and Debian images, update status Signed-off-by: mudler <[email protected]> * 📖 Add bundles and core sections Signed-off-by: mudler <[email protected]> * 📖 Rephrase Signed-off-by: mudler <[email protected]> * 📖 Rephrase Signed-off-by: mudler <[email protected]> * 📖 Add p2p samples Signed-off-by: mudler <[email protected]> * 📖 Rephrase Signed-off-by: mudler <[email protected]> * 📖 Rephrase Signed-off-by: mudler <[email protected]> * Update docs/content/en/docs/Advanced/bundles.md Co-authored-by: Dimitris Karakasilis <[email protected]> Signed-off-by: Ettore Di Giacinto <[email protected]> * Update docs/content/en/docs/Examples/multi-node-p2p-ha-kubevip.md Co-authored-by: Mauro Morales <[email protected]> Signed-off-by: Ettore Di Giacinto <[email protected]> * Update docs/content/en/docs/Examples/bundles.md Co-authored-by: Dimitris Karakasilis <[email protected]> Signed-off-by: Ettore Di Giacinto <[email protected]> * Update docs/content/en/docs/Examples/multi-node-p2p-ha-kubevip.md Co-authored-by: Dimitris Karakasilis <[email protected]> Signed-off-by: Ettore Di Giacinto <[email protected]> * Update docs/content/en/docs/Examples/multi-node-p2p.md Co-authored-by: Dimitris Karakasilis <[email protected]> Signed-off-by: Ettore Di Giacinto <[email protected]> * Update docs/content/en/docs/Examples/multi-node.md Co-authored-by: Dimitris Karakasilis <[email protected]> Signed-off-by: Ettore Di Giacinto <[email protected]> * Update docs/content/en/docs/Examples/multi-node-p2p-ha.md Co-authored-by: Dimitris Karakasilis <[email protected]> Signed-off-by: Ettore Di Giacinto <[email protected]> * Update docs/content/en/docs/Examples/single-node.md Co-authored-by: Dimitris Karakasilis <[email protected]> Signed-off-by: Ettore Di Giacinto <[email protected]> * Update docs/content/en/docs/Reference/configuration.md Co-authored-by: Dimitris Karakasilis <[email protected]> Signed-off-by: Ettore Di Giacinto <[email protected]> * 📖 Review Signed-off-by: mudler <[email protected]> * 📖 Review Signed-off-by: mudler <[email protected]> Signed-off-by: mudler <[email protected]> Signed-off-by: Ettore Di Giacinto <[email protected]> Co-authored-by: Dimitris Karakasilis <[email protected]> Co-authored-by: Mauro Morales <[email protected]>
- Loading branch information
1 parent
286efcf
commit 1cb4996
Showing
18 changed files
with
754 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,151 @@ | ||
--- | ||
title: "Bundles" | ||
linkTitle: "Bundles" | ||
weight: 5 | ||
description: > | ||
Bundles are a powerful feature of Kairos that allow you to customize and configure your operating system. This section explains how to use and build custom bundles. | ||
--- | ||
|
||
Bundles are a powerful feature of Kairos that allow you to customize and configure your operating system, as well as your Kubernetes cluster. Whether you want to add custom logic, install additional packages, or make any other changes to your system, bundles make it easy to apply these changes after installation or before bootstrapping a node. | ||
|
||
Bundles are container images containing only files (and not full OS) that can be used to install new software or extend the cloud-init syntax. You can find community-supported bundles in the [community-bundles](https://github.com/kairos-io/community-bundles) repository. | ||
|
||
## Consuming Bundles | ||
|
||
To use a bundle in your Kairos configuration, you will need to specify the type of bundle and the target image in your cloud-config file. | ||
|
||
To apply a bundle before Kubernetes starts, you can include it in your config like this: | ||
|
||
```yaml | ||
#cloud-config | ||
|
||
bundles: | ||
- targets: | ||
- run://<image> | ||
``` | ||
Replace `<image>` with the URL or path to the bundle image. The prefix (e.g. `run://`) indicates the type of bundle being used. | ||
|
||
To install a bundle after installation instead (for those bundles that explicitly supports that), use the following: | ||
|
||
```yaml | ||
#cloud-config | ||
install: | ||
bundles: | ||
- targets: | ||
- run://<image> | ||
``` | ||
|
||
One of the benefits of using bundles is that they can also extend the cloud-config keywords available during installation. This means that by adding bundles to your configuration file, you can add new blocks of configuration options and customize your system even further. | ||
|
||
A full config using a bundle from [community-bundles](https://github.com/kairos-io/community-bundles) that configures `metalLB` might look like this: | ||
|
||
```yaml | ||
#cloud-config | ||
hostname: kairoslab-{{ trunc 4 .MachineID }} | ||
users: | ||
- name: kairos | ||
ssh_authorized_keys: | ||
# Add your github user here! | ||
- github:mudler | ||
k3s: | ||
enable: true | ||
args: | ||
- --disable=servicelb | ||
# Specify the bundle to use | ||
bundles: | ||
- targets: | ||
- run://quay.io/kairos/community-bundles:metallb_latest | ||
# Specify metallb settings | ||
metallb: | ||
version: 0.13.7 | ||
address_pool: 192.168.1.10-192.168.1.20 | ||
``` | ||
|
||
## Bundle types | ||
|
||
Bundles can carry also binaries that can be overlayed in the rootfs, either while [building images](/docs/advanced/build) or with [Live layering](https://kairos.io/docs/advanced/livelayering/). | ||
|
||
Kairos supports three types of bundles: | ||
|
||
- **Container**: This type is a bare container that simply contains files that need to be copied to the system. It is useful for copying over configuration files, scripts, or any other static content that you want to include on your system (prefixed with `container:` or `docker:`). | ||
|
||
- **Run**: This type is also a bare container, but it comes with a script that can be run during the installation phase to add custom logic. This is useful for performing any necessary setup or configuration tasks that need to be done before the cluster is fully deployed (prefixed with `run:`). | ||
|
||
- **Package**: This type is a [luet](https://luet.io) package that will be installed in the system. It requires you to specify a `luet` repository in order to work. Luet packages are a powerful way to manage dependencies and install software on your system (prefixed with `luet:`). | ||
|
||
|
||
{{% alert title="Note" %}} | ||
In the future, Kairos will also support a local type for use in airgap situations, where you can pre-add bundles to the image before deployment. | ||
{{% /alert %}} | ||
|
||
It's important to note that bundles do not have any special meaning in terms of immutability. They install files over paths that are mutable in the system, as they are simply overlaid during the boot process. This means that you can use bundles to make changes to your system at any time, even after it has been deployed. | ||
|
||
## Create bundles | ||
|
||
To build your own bundle, you will need to create a Dockerfile and any necessary files and scripts. A bundle is simply a container image that includes all the necessary assets to perform a specific task. | ||
|
||
To create a bundle, you will need to define a base image and copy over any necessary files and scripts to the image. For example, you might use the following Dockerfile to create a bundle image that deploys everything inside `assets` in the Kubernetes cluster: | ||
|
||
```Dockerfile | ||
FROM alpine | ||
COPY ./run.sh / | ||
COPY ./assets /assets | ||
``` | ||
|
||
And the associated `run.sh` that installs the assets depending on a cloud-config keyword can be: | ||
|
||
```bash | ||
#!/bin/bash | ||
K3S_MANIFEST_DIR="/var/lib/rancher/k3s/server/manifests/" | ||
mkdir -p $K3S_MANIFEST_DIR | ||
# IF the user sets `example.enable` in the input cloud config, we install our assets | ||
if [ "$(kairos-agent config get example.enable | tr -d '\n')" == "true" ]; then | ||
cp -rf assets/* $K3S_MANIFEST_DIR | ||
fi | ||
``` | ||
|
||
This Dockerfile creates an image based on the Alpine base image, and copies over a script file and some assets to the image. | ||
You can then add any additional instructions to the Dockerfile to install necessary packages, set environment variables, or perform any other tasks required by your bundle. | ||
|
||
Once you have created your Dockerfile and any necessary script files, you can build your bundle image by running docker build and specifying the path to your Dockerfile. | ||
|
||
For example: | ||
|
||
```bash | ||
docker build -t <image> . | ||
``` | ||
|
||
This command will build an image with the name you specify ( replace `<image>` accordingly ) based on the instructions in your Dockerfile. | ||
|
||
After building your bundle image, you will need to push it to a registry so that it can be accessed by Kairos. You can use a public registry like Docker Hub. To push your image to a registry, use the docker push command. For example: | ||
|
||
```bash | ||
docker push <image> | ||
``` | ||
|
||
This will push the `<image>` to your specified registry. | ||
|
||
And use it with Kairos: | ||
|
||
```yaml | ||
#cloud-config | ||
|
||
bundles: | ||
- targets: | ||
# e.g. run://quay.io/...:tag | ||
- run://<image> | ||
|
||
example: | ||
enable: true | ||
``` | ||
See the [community-bundles repository](https://github.com/kairos-io/community-bundles) for further examples. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
--- | ||
title: "Bundles" | ||
linkTitle: "Bundles" | ||
weight: 4 | ||
description: > | ||
This section describe examples on how to use a Kairos bundle to deploy MetalLB on top of K3s | ||
--- | ||
|
||
Welcome to the guide on setting up MetalLB on a Kairos cluster with K3s! This tutorial will walk you through the steps of using a Kairos [bundle](/docs/advanced/bundles) to automatically configure MetalLB on your local network with an IP range of `192.168.1.10-192.168.1.20`. Check out the [MetalLB](/docs/examples/metallb) example to configure it without a [bundle](/docs/advanced/bundles). | ||
|
||
For those unfamiliar with [MetalLB](https://metallb.universe.tf/), it is an open-source load balancer implementation for bare metal Kubernetes clusters that utilizes standard routing protocols. When used with K3s on Kairos, it provides load balancing capabilities and helps manage IP addresses within a cluster. | ||
|
||
|
||
## Prerequisites | ||
|
||
Before we begin, you will need to have the following: | ||
|
||
1. Kairos [provider-kairos](https://github.com/kairos-io/provider-kairos) artifacts which includes K3s | ||
1. A baremetal node to run the installation | ||
|
||
## Installation | ||
|
||
1. Follow the [Installation](/docs/installation) documentation for Kairos. | ||
1. Use the following cloud configuration file when setting up Kairos: | ||
|
||
```yaml | ||
#cloud-config | ||
|
||
hostname: metal-{{ trunc 4 .MachineID }} | ||
users: | ||
- name: kairos | ||
# Change to your pass here | ||
passwd: kairos | ||
ssh_authorized_keys: | ||
# Replace with your github user and un-comment the line below: | ||
# - github:mudler | ||
|
||
k3s: | ||
enabled: true | ||
args: | ||
- --disable=traefik,servicelb | ||
|
||
# Specify the bundle to use | ||
bundles: | ||
- targets: | ||
- run://quay.io/kairos/community-bundles:metallb_latest | ||
|
||
# Specify metallb settings, available only with the bundle. | ||
metallb: | ||
version: 0.13.7 | ||
address_pool: 192.168.1.10-192.168.1.20 | ||
``` | ||
There are a few key points to note in the configuration file: | ||
- The `metallb` block is provided by the MetalLB bundle and allows us to specify the version of MetalLB that we want to deploy, as well as the `address_pool` available for our services. | ||
- The `bundles` block enables the `run` [bundle](/docs/advanced/bundles) type. The bundle we are using is part of the [community-bundles](https://github.com/kairos-io/community-bundles) repository. | ||
|
||
And that's it! With these steps, you should now have MetalLB configured and ready to use on your Kairos cluster. If you have any questions or run into any issues, don't hesitate to check out the [bundle documentation](/docs/advanced/bundles) or reach out to the community for support. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
--- | ||
title: "Using Kairos Core Images as an Installer" | ||
linkTitle: "Using Kairos Core Images as an Installer" | ||
weight: 4 | ||
description: > | ||
Core images serve as the foundation for creating downstream images or as an installer for deploying other images during the installation process. In this guide, we'll take a closer look at using Kairos core images as an installer to deploy other container images. | ||
--- | ||
|
||
Kairos is a powerful, open-source meta-distribution that allows you to easily deploy and manage nodes on your Immutable infrastructure. | ||
|
||
One key feature of Kairos is the use of its core images, which are released as part of the [kairos-io/kairos](https://github.com/kairos-io/kairos) repository and can be found in the releases section. These core images serve as the foundation for creating [downstream images](/docs/advanced/customizing) or as an installer for deploying other images during the installation process. In this guide, we'll take a closer look at using Kairos core images as an installer to deploy other container images. | ||
|
||
## Getting started | ||
|
||
To begin using Kairos core images as an installer, you'll need to start by using the artifacts from the [Kairos core](https://github.com/kairos-io/kairos/releases) repository. These images do not include the Kubernetes engine, so you'll need to configure the container image you want to deploy in the `install.image` field of your cloud config file. A list of available images can be found in [our support matrix](/docs/reference/image_matrix). | ||
|
||
For example, let's say you want to use an image from the provider-kairos repository. Your cloud config file might look something like this: | ||
|
||
```yaml | ||
#cloud-config | ||
install: | ||
# Here we specify the image that we want to deploy | ||
image: "docker:quay.io/kairos/kairos-opensuse:v1.4.0-k3sv1.26.0-k3s1" | ||
``` | ||
Once you've chosen your image, you can move on to the installation process by following the steps outlined in our [Installation](/docs/installation) documentation. | ||
For example, a full cloud-config might look like this: | ||
```yaml | ||
#cloud-config | ||
|
||
install: | ||
device: "auto" | ||
auto: true | ||
reboot: true | ||
# Here we specify the image that we want to deploy | ||
image: "docker:quay.io/kairos/kairos-opensuse:v1.4.0-k3sv1.26.0-k3s1" | ||
|
||
hostname: "test" | ||
users: | ||
- name: "kairos" | ||
passwd: "kairos" | ||
ssh_authorized_keys: | ||
- github:mudler | ||
|
||
k3s: | ||
enable: true | ||
``` | ||
## Configuring the installation | ||
As you move through the installation process, there are a few key points to keep in mind when configuring your cloud config file: | ||
- We set `install.image` to the container image that we want to deploy. This can be an image from [our support matrix](/docs/reference/image_matrix), a [custom image](/docs/advanced/customizing) or an [image from scratch](/docs/reference/build). | ||
- After the installation is complete, the configuration in the `k3s` block will take effect. This is because after the installation, the system will boot into the image specified in the `install.image` field, which in the example above is an image with the Kairos K3s provider, as such the configuration in the k3s block will become active. | ||
|
||
With these steps, you should now be able to use Kairos core images as an installer to deploy other container images. The process is straightforward and gives you the flexibility to customize your deployments and build custom images as needed. | ||
|
||
You can also refer our [troubleshoot](/docs/reference/troubleshooting) document if you are facing any issue while following the installation process. |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.