Skip to content

Deploy a Traefik Proxy

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:

Terminal window
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:

Terminal window
# 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:

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

The output shows the instance URL and other details:

Terminal window
[] 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.

Terminal window
curl https://holy-cherry-rye39b1x.fra0.kraft.host:8080/dashboard
<!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.

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

Terminal window
kraft cloud instance list
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:

Terminal window
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:

Terminal window
kraft cloud --help

Or visit the CLI Reference.