Skip to content

Quickstart

If you have not installed Ankaios, please follow the instructions here. The following examples assumes that the installation script has been used with default options.

You can start workloads in Ankaios in a number of ways. For example, you can define a file with the startup configuration and use systemd to start Ankaios. The startup configuration file contains all of the workloads and their configuration that you want to be started by Ankaios.

Let's modify the default config which is stored in /etc/ankaios/state.yaml:

apiVersion: v0.1
workloads:
  nginx:
    runtime: podman
    agent: agent_A
    restartPolicy: ALWAYS
    tags:
      - key: owner
        value: Ankaios team
    runtimeConfig: |
      image: docker.io/nginx:latest
      commandOptions: ["-p", "8081:80"]

Then we can start the Ankaios server:

sudo systemctl start ank-server

The Ankaios server will read the config but detect that no agent with the name agent_A is available that could start the workload, see logs with:

journalctl -t ank-server

Now let's start an agent:

sudo systemctl start ank-agent

This Ankaios agent will run the workload that has been assigned to it. We can use the Ankaios CLI to check the current state:

ank get state

which creates:

startupState:
  apiVersion: v0.1
  workloads: {}
desiredState:
  apiVersion: v0.1
  workloads:
    nginx:
      agent: agent_A
      tags:
      - key: owner
        value: Ankaios team
      dependencies: {}
      restartPolicy: ALWAYS
      runtime: podman
      runtimeConfig: |
        image: docker.io/nginx:latest
        commandOptions: ["-p", "8081:80"]
workloadStates:
- instanceName:
    agentName: agent_A
    workloadName: nginx
    id: 7d6ea2b79cea1e401beee1553a9d3d7b5bcbb37f1cfdb60db1fbbcaa140eb17d
  executionState:
    state: Running
    subState: Ok
    additionalInfo: ''

or

ank get workloads

which results in:

WORKLOAD NAME   AGENT     RUNTIME   EXECUTION STATE   ADDITIONAL INFO
nginx           agent_A   podman    Running(Ok)

Ankaios also supports adding and removing workloads dynamically. To add another workload call:

ank run workload \
helloworld \
--runtime podman \
--agent agent_A \
--config 'image: docker.io/busybox:1.36
commandOptions: [ "-e", "MESSAGE=Hello World"]
commandArgs: [ "sh", "-c", "echo $MESSAGE"]'

We can check the state again with ank get state and see, that the workload helloworld has been added to desiredState.workloads and the execution state is available in workloadStates.

As the workload had a one time job its state is Succeeded(Ok) and we can delete it from the state again with:

ank delete workload helloworld

For next steps follow the tutorial on sending and receiving vehicle data with workloads orchestrated by Ankaios. Then also check the reference documentation for the startup configuration including the podman-kube runtime and also working with the complete state data structure.