Zudoku
Guides

Traefik

This example uses the Traefik cloud native app proxy.

To run this example, follow these steps:

  1. Install the kraft CLI tool and a container runtime engine, for example Docker.

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

Code(bash)
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. This guide uses fra (Frankfurt, ๐Ÿ‡ฉ๐Ÿ‡ช):

Code(bash)
# Set Unikraft Cloud access token export UKC_TOKEN=token # Set metro to Frankfurt, DE export UKC_METRO=fra

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

Code(bash)
kraft cloud deploy -M 512 -p 443:80/tls+http -p 8080:8080/tls .

The output shows the instance address and other details:

Code(ansi)
[โ—] Deployed successfully! โ”‚ โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ name: traefik-wqe7e โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ uuid: 69d25b0b-1813-4a3f-88e6-64abbc78b359 โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ state: running โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ url: https://holy-cherry-rye39b1x.fra.unikraft.app โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ 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 address is https://holy-cherry-rye39b1x.fra.unikraft.app. They're different for each run.

Use curl to query the Unikraft Cloud instance of Traefik.

Code(bash)
curl https://holy-cherry-rye39b1x.fra.unikraft.app:8080/dashboard
Code(text)
<!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 change default.toml as needed.

You can list information about the instance by running:

Code(bash)
kraft cloud instance list
Code(text)
NAME FQDN STATE CREATED AT IMAGE MEMORY ARGS BOOT TIME traefik-wqe7e holy-cherry-rye39b1x.fra.unikraft.app running 8 minutes ago traefik@sha256:f6dd913a8... 512 MiB /usr/bin/traefik -configFile /etc/traefik/... 53661us

When done, you can remove the instance:

Code(bash)
kraft cloud instance remove traefik-wqe7e

Customize your app

To customize Traefik app you can change the default.toml configuration file.

Learn more

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

Code(bash)
kraft cloud --help

Or visit the CLI Reference.

Last modified on