Zudoku
Guides

Traefik

This example uses the Traefik cloud native application proxy.

To run this example, follow these steps:

  1. Install the kraft CLI tool and a container runtime engine, e.g. Docker.

  2. Clone the examples repository and cd into the examples/traefik/ directory:

TerminalCode
git clone https://github.com/kraftcloud/examples cd examples/traefik/

Make sure to log into Unikraft Cloud by setting your token and a metro close to you. We use fra0 (Frankfurt, ๐Ÿ‡ฉ๐Ÿ‡ช) in this guide:

TerminalCode
# Set Unikraft Cloud access token export UKC_TOKEN=token # Set metro to Frankfurt, DE export UKC_METRO=fra0

When done, invoke the following command to deploy this application on Unikraft Cloud:

TerminalCode
kraft cloud deploy -M 512 -p 443:80/tls+http -p 8080:8080/tls .

The output shows the instance URL and other details:

TerminalCode
[โ—] Deployed successfully! โ”‚ โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ name: traefik-wqe7e โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ uuid: 69d25b0b-1813-4a3f-88e6-64abbc78b359 โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ state: running โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ url: https://holy-cherry-rye39b1x.fra0.kraft.host โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ image: traefik@sha256:f6dd913a81f6a057ceb9db7844222d7287b2a83f668cca88c73c2e85554cb526 โ”œโ”€โ”€โ”€โ”€โ”€ boot time: 53.66 ms โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ memory: 512 MiB โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€ service: holy-cherry-rye39b1x โ”œโ”€โ”€ private fqdn: traefik-wqe7e.internal โ”œโ”€โ”€โ”€โ”€ private ip: 172.16.28.16 โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ args: /usr/bin/traefik -configFile /etc/traefik/default.toml

In this case, the instance name is traefik-wqe7e and the URL is https://holy-cherry-rye39b1x.fra0.kraft.host. They are different for each run.

Use curl to query the Unikraft Cloud instance of Traefik.

TerminalCode
curl https://holy-cherry-rye39b1x.fra0.kraft.host:8080/dashboard
Code
<!DOCTYPE html><html><head><title>Traefik</title><meta charset=utf-8><meta name=description content="Traefik UI"> ...

Or better yet, point a browser at the dashboard.

This set up exposes the dashboard on port 8080 without authentication. Please modify default.toml as needed.

At any point in time, you can list information about the instance:

TerminalCode
kraft cloud instance list
Code
NAME FQDN STATE CREATED AT IMAGE MEMORY ARGS BOOT TIME traefik-wqe7e holy-cherry-rye39b1x.fra0.kraft.host running 8 minutes ago traefik@sha256:f6dd913a8... 512 MiB /usr/bin/traefik -configFile /etc/traefik/... 53661us

When done, you can remove the instance:

TerminalCode
kraft cloud instance remove traefik-wqe7e

Customize your Application

To customize Traefik application you can modify the default.toml configuration file.

Learn More

Use the --help option for detailed information on using Unikraft Cloud:

TerminalCode
kraft cloud --help

Or visit the CLI Reference.

Last modified on