Skip to content

Kubernetes

This quickstart guides you through five steps, installing Traefik Proxy, the Traefik Hub Agent and publishing a service (application) with HTTP authentication.

Introduction

In this example, you will be using a demo application called whoami, a web server answering with host-related information.

Before you begin

Before getting started, make sure you have the following:

1. Install Traefik and the Hub Agent

Login to Traefik Hub and select Install my first Traefik Hub Agent

Choose Kubernetes as platform.

Choose Kubernetes as platform

1.1 Add Traefik Helm repository

Add Helm chart

1.2 Install Traefik proxy

Install Traefik Proxy via Helm

1.3 Install Traefik hub-agent

Install Traefik Hub Agent via Helm

1.4 Save the token

Save the token in a secure place!

Select Copy and save your token.

Save the token in a secure place

2. Deploy the demo application

Use kubectl to deploy the demo application.

kubectl create deployment whoami --image=traefik/whoami
kubectl create service loadbalancer whoami --tcp=8080:80

3. Name the Agent

Switch back to the Traefik Hub UI and name the Agent.

Name the Hub Agent

4. Publish the service

Now, in the Traefik Hub UI, choose whoami under services and select Publish the service.

Choose whoami service in UI

Before you publish, check that the service port and the network are configured properly.

Make sure to use port 80, this is the port of the whoami application configured in the Docker run command.

Choose the traefik-hub network, this is the network you configured for Traefik and Traefik Hub.

Select Save and Publish.

Service port and network

After a few moments, your service will be ready and published.

Check that the service port(s) and the network are configured, and select Save and Publish.

After a few moments, your service will be ready and published.

You can test it by browsing to the shown URL.

welcome to traefik hub

5. Secure the service

In the next step, you will create and add an Access Control Policy (ACP). This ACP will secure the published service with HTTP authentication.

Select Add Access Control on the whoami overview page.

welcome to traefik hub

Select Create new ACP.

5.1 Create the ACP

Now you will create the ACP (Access Control Policy) to secure the whoami service with basic HTTP authentication.

Create new ACP

HTTP auth

Name

Give it a clear name, identifying what kind of policy it is, for example basic-auth-acp.

Method

Select Basic Auth.

Users

Set a username and a secure password, these will be later used for authentication.

Once you're done, select Save.

5.2 Select Access Control

Assign the created ACP to the service and select Save.

Select ACP

After a few moments, the ACP will be activated.

ACP is selected

Browse to the URL of your demo application.

Login with ACP

Fill in your username and password to reach the application.


In this guide, you learned how to install the Traefik Hub Agent and publishing a service (application) with HTTP authentication using Traefik Hub.

What's next

Now that you've completed this quickstart guide, try these to learn more about Traefik Hub.