Deploy a Traefik Proxy
This example uses the Traefik
cloud native application proxy.
To run this example, follow these steps:
-
Install the
kraft
CLI tool and a container runtime engine, e.g. Docker. -
Clone the
examples
repository andcd
into theexamples/traefik/
directory:
git clone https://github.com/kraftcloud/examplescd 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:
# Set Unikraft Cloud access tokenexport UKC_TOKEN=token# Set metro to Frankfurt, DEexport UKC_METRO=fra0
When done, invoke the following command to deploy this application on Unikraft Cloud:
kraft cloud deploy -M 512 -p 443:80/tls+http -p 8080:8080/tls .
The output shows the instance URL and other details:
[●] 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.
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:
kraft cloud instance list
NAME FQDN STATE CREATED AT IMAGE MEMORY ARGS BOOT TIMEtraefik-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:
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:
kraft cloud --help
Or visit the CLI Reference.