Full Documentation KOSI-2.13.x

KubeOps KOSI

How to use KOSI

This guide explains how to use KOSI with detailed instructions and examples.

General commands

Overview of all KOSI commands

kosi:
  Kosi is a SoftwareINstAller for kubernetes cluster

Usage:
  Kosi [options] [command]

Options:
  --version         Show version information
  -?, -h, --help    Show help and usage information

Commands:
  login                    logs you in
  search                   Shows you all the available packages on the softwarehub
  build                    Creates your final kosi.package
  push                     Push package.tgz to KubeOps Hub.
  pull <package>           Downloads an existing package from the hub without installing.
  install <packagename>    install a .tgz file and if it is required, download it
  update <packagename>     update a .tgz file and if it is required, download it
  delete <packagename>     run delete section of a .tgz file and if it is required, download it
  list                     List packages from storage
  lint                     lint your files for your .tgz package
  create                   Creates a package.kosi and a template.yaml for you to manipulate
  version                  Basic infos about KOSI
  logout                   Logout
  remove <package>         Gives you the possibility to remove packages from the hub, if you have write permissions.
  encrypt                  Gives you the possibility to encrypt your values with a password.
  check <hash>             check your local package hash

Command ‘kosi –help’

The command kosi --help gives you an overview of all available commands:

kosi --help

Alternatively, you can also enter kosi or kosi -? in the command line.

Command ‘kosi version’

The kosi version command shows you the current version of KOSI.

kosi version

The output should be:

2025-03-18 08:07:41 Info:      KOSI version: 2.13.0.1
2025-03-18 08:07:41 Info:      Latest KOSI-package-apiversion is: kubernative/kubeops/sina/user/v4
2025-03-18 08:07:41 Info:      Latest KOSI-lanugage-version is: 1.0.0
2025-03-18 08:07:41 Info:      This work is licensed under Creative Commons Attribution - NoDerivatives 4.0 International License(see https://creativecommons.org/licenses/by-nd/4.0/legalcode for more details).
2025-03-18 08:07:41 Info:      © KubeOps GmbH, Hinter Stöck 17, 72406 Bisingen - Germany, 2025

Command ‘kosi create’

The command kosi create creates four files (package.kosi, template.yaml, logo.png and docs.tgz) in the current directory. These files can be edited by the user.

kosi create

Created files:

  • package.kosi
  • template.yaml
  • logo.png - For showing logo on the KubeOpsHub.
  • docs.tgz - For showing documentation on the KubeOpsHub.

Command ‘kosi build’

The kosi build command creates the necessary yaml files for building a package:

kosi build

All files specified in the package.kosi are combined together with the package.yaml to form a KOSI package.

Command ‘kosi lint’

The kosi lint command is used to check whether the contents of the package.yaml or package.kosi files are valid:

kosi lint

Command ‘kosi login’

The kosi login command logs on to the KubeOps services. The account name is required for this command.

After the flag -u type your username. Afterwards you will be asked to enter your password.

kosi login -u <username>

The parameter -p is used to enter the password in the command directly, but it is important to know that the password will be shown in plain text. This parameter can help with the automation of KOSI commands.

kosi login -u <username> -p <password>

-u flag

The -u parameter is used to specify the user name.

kosi login -u

-p flag

The -p parameter is used to specify the password.

kosi login -p

Command ‘kosi logout’

The kosi logout command logs out from the KubeOps services.

kosi logout

Command ‘kosi push’

The kosi push command uploads KOSI packages to the KubeOps Hub:

kosi push --hub <hubname>

–hub flag

The --hub parameter is used to upload KOSI packages to a specific hub, e.g. in this example we upload our KOSI package to the myhub hub.

kosi push --hub myhub

Command ‘kosi pull’

The kosi pull command downloads a specific KOSI package from the hub without installing it directly.

kosi pull --hub <hubname> <packagename> -o <desired name>

Example:

kosi pull --hub myhub donald/kosi-print-test:0.0.1 -o printpackage

–hub flag

The --hub parameter is used to download KOSI packages to a specific hub, e.g. in this example we are pulling our KOSI package from the myhub hub.

kosi pull --hub myhub kubeops/harbor:1.1.0  

-r flag

The parameter r can be used to pull the docker images which are included in the package to a given local docker registry.

kosi pull --hub <hubname> <packagename> -o <desired name> -r <local.docker.registry>

Example:

kosi pull --hub myhub kubeops/harbor:1.1.0   -o harborpackage -r 127.0.0.1:5000

Note: After the kosi pull --hub myhub kubeops/harbor:1.1.0 -o printpackage -r 127.0.0.1:5000 command you can use kosi install -p printpackage.tgz to use the docker image from your local docker registry.

-t flag

For the szenario that the registry of the cluster is exposed to the admin via a network internal domain name, but this name can’t be resolved by the nodes, the flag -t can be used, to use the cluster internal hostname of the registry.

kosi pull --hub <hubname> <packagename> -o <desired name> -r <local.docker.registry> -t <cluster.internal.registry>

Example:

kosi pull --hub myhub kubeops/harbor:1.1.0 -o harborpackage -r myregistry:5000 -t clusterregistry:5000

The kosi search command displays all available packages of your own private hub. Only the logged in user can see the packages on his private hub. The User column contains the name of the creator of the package.
The Name column contains the name of the package.
The Version column contains the version of the package.
The Description column contains the description of the package.
The Install column contains a string consisting of the name of the creator, name and version of the package. This string can be copied and used for the kosi install command.

kosi search --hub <hubname>

Example: User donald is logged in and wants to get the packets from his private hub:

kosi search --hub donald
| User   | Name         | Version | Description                      |Install                    |
|--------|--------------|---------|----------------------------------|---------------------------|                  
| donald | private-kosi | 0.0.1   | private installation             | donald/private-kosi:0.0.1 |                                       
| donald | private-test | 0.0.1   | private package                  | donald/private-test:0.0.1 |
| donald | livedemo     | 2.7.2   | welcome to kosi                  | donald/livedemo:2.7.1     | 

–ps flag

The --ps parameter can be used to filter for keywords that refer to all five columns. It is also possible to filter by individual word components:

kosi search --hub <hubname> --ps <name>

Example:
In this case, all packets containing the word private are displayed:

kosi search --hub donald --ps private
| User   | Name         | Version | Description                      |Install                    |
|--------|--------------|---------|----------------------------------|---------------------------|                  
| donald | private-kosi | 0.0.1   | private installation             | donald/private-kosi:0.0.1 |                                       
| donald | private-test | 0.0.1   | private package                  | donald/private-test:0.0.1 |                                        

–hub flag

In addition, there is an option to search for packages on a specific hub using the --hub parameter. You need no login to search in the myhub hub.

kosi search --hub myhub
| User   | Name         | Version | Description                      |Install                  |
|--------|--------------|---------|----------------------------------|-------------------------|
| kosi   | lima         | 0.6.2   | installs LIMA                    | kosi/lima:0.6.2         |
| kosi   | installation | 0.0.1   | kosi create example package.yaml | kosi/installation:0.0.1 |  
| donald | elk-kosi     | 0.0.1   | ELK installation                 | donald/elk-kosi:0.0.1   |
| donald | prod-test    | 0.0.1   | test for prod                    | donald/prod-test:0.0.1  | 
| lima   | lima         | 0.6.0   | installs LIMA                    | lima/lima:0.6.0         |
                                     

The parameters --hub and --ps can be combined for a targeted search in the kosi hub:

kosi search --hub <hubname> --ps <package_name>

Example:
The user kosi wants to display all packages in the kosi hub with the term “lima”.

kosi search --hub kosi  --ps lima
| User | Name         | Version | Description                      |Install                  |
|------|--------------|---------|----------------------------------|-------------------------|
| kosi | lima         | 0.6.2   | installs LIMA                    | kosi/lima:0.6.2         |
| kosi | lima         | 0.7.1   | installs LIMA                    | kosi/lima:0.7.1         |
                                     

Command ‘kosi encrypt’

The kosi encrypt command is used to encrypt YAML files with AES-256-CBC:

-f flag

The parameter -f must be used to use yaml files from the user.

kosi encrypt -f <user.yaml>
kosi encrypt -f userfile1.yaml -f userfile2.yaml -f userfile3.yaml

Command ‘kosi install’

The kosi install command installs a KOSI package:

kosi install --hub <hubname> <package>

Example: The package livedemo of the user kosi with version 2.7.1 is to be installed from the myhub Hub:

kosi install --hub myhub kosi/livedemo:2.7.1 

–hub flag

The --hub parameter must be used to install packages from the software hub. Only the logged in user can install the packages from the software hub.

kosi install --hub <hubname> <package>

Example: The package livedemo of the user kosi with version 2.7.1 is to be installed from the myhub Software Hub:

kosi install --hub myhub kosi/livedemo:2.7.1

-p flag

The “p” parameter must be used to install local packages. For “p” parameter you need no --hub:

kosi install -p package.tgz

-f flag

The parameter f must be used to use .yaml files from the user.

kosi install <package> -f <user.yaml>

Example: The package livedemo of the user kosi with version 2.7.1 is to be installed from the myhub software hub and user specific files are to be used for the installation:

kosi install --hub myhub kosi/livedemo:2.7.1 -f userfile1.yaml -f userfile2.yaml -f userfile3.yaml

–cf flag

The parameter --cf must be used to use encrypted yaml files from the user.

kosi install <package> --cf <encryptedUser.yaml>

Example: The package livedemo of the user kosi with version 2.7.1 is to be installed from the myhub software hub and user specific encrypted files are to be used for the installation:

kosi install --hub myhub kosi/livedemo:2.7.1 --cf encryptedUserfile1.yaml --cf encryptedUserfile2.yaml --cf encryptedUserfile3.yaml

Example:

kosi install --hub myhub kosi/livedemo:2.7.1 -f userfile1.yaml -f userfile2.yaml --cf encryptedUserfile1.yaml --cf encryptedUserfile2.yaml

–namespace flag

The namespace parameter can be used to specify a Kubernetes namespace in which the installation is to be performed.

kosi install --hub <hubname> <package> --namespace <namespace>

Example: The package livedemo of the user kosi with version 2.7.1 is to be installed from the myhub software hub and a custom kubernetes namespace is used:

kosi install --hub myhub kosi/livedemo:2.7.1 --namespace MyNamespace

–dname flag

The parameter dname can be used to save the package under a specific name.

kosi install --hub <hubname> <package> --dname <deploymentname>

Example: The package livedemo of the user kosi with version 2.7.1 is to be installed from the myhub software hub and a deployment name is set:

kosi install --hub myhub kosi/livedemo:2.7.1 --dname MyDeployment

Command ‘kosi list’

The kosi list command lists all installed KOSI packages:

kosi list
 KOSI version: 2.10.0_preAlpha0
| Deployment       | Package                           | PublicHub | Hub    |
|------------------|-----------------------------------|-----------|--------|
| kosiinstallslima | kosi/lima:0.6.2                   |           | private|
| kosicreatetest   | kosi/kosi-create:0.0.1            |           | public |
| plugininstall    | local/kubeops-basic-plugins:0.4.0 |           | local  |

Command ‘kosi update’

The kosi update command updates an already installed KOSI package:

kosi update --hub <hubname> --dname <deploymentname> <package>

Example: The installation of the package lima from the user kosi with version 0.6.2 and deployment name kosiInstallsLima is updated by a package from the myhub Software Hub from kosi.:

kosi update --hub myhub --dname kosiInstallsLima kosi/kosi/lima:0.6.2 

–hub flag

The --hub parameter must be used to update packages from the software hub. Only the logged in user can update the packages from the software hub.

kosi update --hub <hubname> <package>

Example: The package livedemo of the user kosi with version 2.7.1 is to be updated from the myhub Software Hub:

kosi update --hub myhub kosi/livedemo:2.7.1
```create:0.0.1

-p flag

The “p” parameter must be used to update the installation from a local package. For “p” parameter you need no --hub parameter:

kosi update -p package.tgz

-f flag

The parameter f must be used to use yaml files from the user.

kosi update --hub <hubname> <package> -f <user.yaml>

Example: The installation of the package livedemo of the user kosi with version 2.7.1 is updated by a package from the myhub software hub and user specific files are to be used for the update progress:

kosi update --hub myhu kosi/livedemo:2.7.1 -f userfile1.yaml -f userfile2.yaml -f userfile3.yaml

Note: The -f parameter can be specified any number of times to use any number of files. Note: The -f parameter can also be combined with the --hub parameters.

–cf flag

The parameter --cf must be used to use encrypted yaml files from the user.

kosi update --hub <hubname> <package> --cf <encryptedUser.yaml>

Example: The installation of the package livedemo of the user kosi with version 2.7.1 is updated by a package from the myhub software hub and user specific encrypted files are to be used for the update progress:

kosi update --hub myhub kosi/livedemo:2.7.1 --cf encryptedUserfile1.yaml --cf encryptedUserfile2.yaml --cf encryptedUserfile3.yaml

Example:

kosi update --hub myhub kosi/livedemo:2.7.1 -f userfile1.yaml -f userfile2.yaml --cf encryptedUserfile1.yaml --cf encryptedUserfile2.yaml

–namespace flag

The namespace parameter can be used to specify a kubernetes namespace in which the update is to be performed.

kosi update --hub <hubname> <package> --namespace <namespace>

Example: The installation of the package livedemo of the user kosi with version 2.7.1 is updated by a package from the myhub software hub and a custom kubernetes namespace is used:

kosi update --hub myhub kosi/livedemo:2.7.1 --namespace MyNamespace

Note: If no --namespace parameter is specified, the default namespace will be used.

–dname flag

The parameter dname can be used to update the deployment by name.

kosi update --hub <hubname> <package> --dname <deploymentname>

Example: The installation of the package livedemo of the user kosi with version 2.7.1 is updated by a package from the myhub software hub and a deployment name is set:

kosi update --hub myhub kosi/livedemo:2.7.1 --dname MyDeployment

Command ‘kosi delete’

The kosi delete command deletes an already installed KOSI package:

kosi delete --hub <hubname> --dname <deploymentname> <package>

Example: The installation of the package lima from the user kosi with version 0.6.2 and deployment name kosiInstallsLima is deleted by a package from the myhub Software Hub from kosi.:

kosi delete --hub myhub --dname kosiInstallsLima kosi/kosi/lima:0.6.2 

–hub flag

The --hub parameter must be used to use the delete section of packages from the software hub. Only the logged in user can use the delete section of packages from the software hub.

kosi delete --hub <hubname> <package>

Example: The package livedemo of the user kosi with version 2.7.1 is to be updated from the myhub Software Hub:

kosi delete --hub myhub kosi/livedemo:2.7.1
```create:0.0.1
```-create:0.0.1

-p flag

The “p” parameter must be used to delete the installation from a local package. For “p” parameter you need no --hub parameter:

kosi delete -p package.tgz

-f flag

The parameter f must be used to use yaml files from the user.

kosi delete --hub <hubname> <package> -f <user.yaml>

Example: The installation of the package livedemo of the user kosi with version 2.7.1 is deleted by a package from the myhub software hub and user specific files are to be used for the delete progress:

kosi delete --hub myhub kosi/livedemo:2.7.1 -f userfile1.yaml -f userfile2.yaml -f userfile3.yaml

–cf flag

The parameter --cf must be used to use encrypted yaml files from the user.

kosi delete --hub <hubname> <package> -f <encryptedUser.yaml>

Example: The installation of the package livedemo of the user kosi with version 2.7.1 is deleted by a package from the myhub software hub and user specific encrypted files are to be used for the delete progress:

kosi delete --hub myhub kosi/livedemo:2.7.1 -f encryptedUserfile1.yaml -f encryptedUserfile2.yaml -f encryptedUserfile3.yaml

Example:

kosi delete --hub myhub kosi/livedemo:2.7.1 -f userfile1.yaml -f userfile2.yaml --cf encryptedUserfile1.yaml --cf encryptedUserfile2.yaml

–namespace flag

The namespace parameter can be used to specify a kubernetes namespace in which to perform the deletion.

kosi delete --hub <hubname> <package> --namespace <namespace>

Example: The installation of the package livedemo of the user kosi with version 2.7.1 is deleted by a package from the myhub software hub and a custom kubernetes namespace is used:

kosi delete --hub myhub kosi/livedemo:2.7.1 --namespace MyNamespace

–dname flag

The parameter dname can be used to delete the deployment by name.

kosi delete --hub <hubname> <package> --dname <deploymentname>

Example: The installation of the package livedemo of the user kosi with version 2.7.1 is deleted by a package from the myhub software hub and a deployment name is set:

kosi delete --hub myhub kosi/livedemo:2.7.1 --dname MyDeployment

Command ‘kosi remove’

The kosi remove command removes a KOSI package from the hub:

kosi remove --hub <hubname> <package>

Example: The package livedemo of the user kosi with version 2.7.1 will be removed from the myhub hub:

kosi remove --hub myhub kosi/livedemo:2.7.1 

Command ‘kosi check’

The kosi check command is used to compare a local kosi package with a sha256 Checksum.

kosi check -p <localpackagename> <sha256 hash>

Example:

kosi check -p examplepackage c83f3db9639e175f82e7d07d342533866873e2d9ca2f0fd5ee607ea395417edb

File Formats

package.kosi

This file defines properties of the KOSI package. This file is created after the kosi create command. The package.kosi defines a package in a specific version as well as the tasks needed to install it. The tasks which are used in the package.yaml are plugins, which can be created by the user. The includes.containers element is used for docker images. A container for the docker images will be created when the kosi install, kosi update or kosi delete command is used. There is also a description, which will be shown in the kosi search command. The includes.files element describes the files which are inluded in the KOSI package. The installation.tasks tree describes the tasks (KOSI plugins), which are executed with the kosi install command. The update.tasks tree describes the tasks (KOSI plugins), which are executed with the kosi update command.The delete.tasks tree describes the tasks (KOSI plugins), which are executed with the kosi delete command.

languageversion = "1.0.0";
apiversion = "kubernative/kubeops/sina/user/v3";
name = "kosi-example-packagev3";
description = "kosi-example-package";
version = "0.1.0";
docs = "docs.tgz";
logo = "logo.png";

files =
{
  input="template.yaml";
}

containers =
{
    example=["docker.io", "nginx", "latest"];
}

install
{
    cmd(command="touch ~/kosiExample1");
}

update
{
    cmd(command="touch ~/kosiExample2");
}

delete
{
    cmd(command="rm ~/kosiExample1");
    cmd(command="rm ~/kosiExample2");
}

package.yaml

This file defines properties of the KOSI package. This file is created after the kosi build command. The package.yaml defines a package in a specific version as well as the tasks needed to install it. The tasks which are used in the package.yaml are plugins, which can be created by the user. The includes.containers element is used for docker images. A container for the docker images will be created when the kosi install, kosi update or kosi delete command is used. There is also a description, which will be shown in the kosi search command. The includes.files element describes the files which are inluded in the KOSI package. The installation.tasks tree describes the tasks (KOSI plugins), which are executed with the kosi install command. The update.tasks tree describes the tasks (KOSI plugins), which are executed with the kosi update command.The delete.tasks tree describes the tasks (KOSI plugins), which are executed with the kosi delete command.

# languageversion: "0.1.0"
apiversion: "kubernative/kubeops/sina/user/v3"
name: "kosi-example-packagev3"
description: "kosi-example-package"
version: "0.1.0"
docs: "docs.tgz"
logo: "logo.png"
includes:
  files:
    input: "template.yaml"
  containers:
    example:
      registry: "docker.io"
      image: "nginx"
      tag: "latest"
installation:
  tasks:
    - cmd:
        command: "touch ~/kosiExample1"
update:
  tasks:
    - cmd:
        command: "touch ~/kosiExample2"
delete:
  tasks:
    - cmd:
        command: "rm ~/kosiExample1"
    - cmd:
        command: "rm ~/kosiExample2"

default.yaml

The default.yaml in a package.tgz is used for setting default variables. In case you use the -f parameter in install, update or delete, the file which you address is merged with the default.yaml. If you have the same keys but different values in both files, your adressed file will overwrite the values set by the default.yaml.

config.yaml

The config.yaml file contains all necessary files for networking and logging. For example, config.yaml contains the hub from which the packages are downloaded.

apiversion: kubernative/kosi/config/v2           # Shows the supported API-Version
spec:                                            
  hub: https://hub.kubernative.net/dispatcher/      # Adress to the KOSI online hub
  plugins: /kubeops/kosi/kosi-plugins/                      # Location of the KOSI-Plugins
  registry: registry1.kubernative.net/             # Registry, where Docker-images will be pulled to (kosi pull)
  workspace: /tmp/kosi/process/                    # Workspace Path 
  logging: info                                    # Loglevel options: info (default), warning, error, debug1, debug2, debug3
  housekeeping: true                               # Housekeeping options: true (all temporary created folders will be deleted), false (all temporary created folders won't be deleted)

Usage

To keep KOSI running there has to be a valid config.yaml file.
After installing KOSI, a valid config.yaml file is created under the location /var/kubeops/kosi/config.yaml. If you want to use your own Hub you can create a user-specific config.yaml file. The original file can be changed too, but it is not recommended.

$KUBEOPSROOT Variable

The $KUBEOPSROOT environment variable stores the location of the KOSI plugins and the config.yaml. To use the variable, the config.yaml and the plugins have to be copied manually.
So for example:

cp -r /var/kubeops/kosi/config.yaml /home/<user>/kubeopsrootdir/kosi/config.yaml
rm -rf /var/kubeops/kosi
cp -r /var/kubeops/plugins /home/<user>/kubeopsrootdir/plugins
rm -rf /var/kubeops/plugins

How to use templating within the package.kosi

This is an example of how templating in a package.kosi is working with kosi 2.10.x

First we need to create this package.kosi:

# languageversion: "0.1.0"
apiversion = "kubernative/kubeops/sina/user/v3";
name = "kosi-example-packagev3";
description = "kosi-example-package";
version = "0.1.0";
docs = "docs.tgz";
logo = "logo.png";

files =
{
  input="template.yaml";
}

containers =
{
    example=["docker.io", "nginx", "latest"];
}

install
{
    cmd(command='"echo using templatep plugin."');
    template(tmpl='{{package.includes.files.input}}';target='{{values.target}}');
}

update
{
    cmd(command='"touch ~/kosiExample2"');
    template(tmpl='{{package.includes.files.input}}';target='{{values.target}}');
}

delete
{
    cmd(command='"rm ~/kosiExample1"');
    cmd(command='"rm ~/kosiExample2"');
}

Now we create a template.yaml:

package:
  file: {{package.includes.files.input}}
  uservalues: {{values.example}}

Next we create a default.yaml:

example: example
target: target.yaml

Now we are ready to create a kosi package. For this we need the following command:

kosi build

Next we can run the installation section we have defined in the package.yaml with the following command:

kosi install -p package.tgz --dname example

We can check the result in the directory $KUBEOPSROOT/kosi/tmp.

The file of interest is the target.yaml. But most of the time this file is not in tmp Folder . In this case, type the command find / -name target.yaml to find the location of the target.yaml file.

the content of target.yaml is:

package:
  file: template.yaml
  uservalues: example

So what exactly happened?
In the package.yaml you can see that we use {{package.includes.files.input}} for defining the template.yaml as value for the key tmpl. You can use any value of the package.yaml but make sure that the path to the value is correct and starts with package.. This is the indicator for using a variable from the package.yaml.

You can also see that we use {{values.target}} for defining the target.yaml as value for the key target. If you wonder where the target.yaml is coming from you can check the default.yaml. If you want to use a variable from the default.yaml or from a file specified with the parameter -f make sure that the path to the value is correct and starts with values..

For more information about the template syntax check the Scriban documentation (https://github.com/scriban/scriban/blob/master/doc/language.md) and try it out in the online demo (https://scribanonline.azurewebsites.net).

Plugins

With the installation of KOSI a handful of plugins are included. Which plugins are included can be seen under “pre-installed plugins” in the Plugin References