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:
- An account registered on the Traefik Hub platform
- A Kubernetes cluster
kubectl
installed and configured- Helm installed
1. Install Traefik and the Hub Agent¶
Login to Traefik Hub and select Install my first Traefik Hub Agent
Choose Kubernetes as platform.
1.1 Add Traefik Helm repository¶
1.2 Install Traefik proxy¶
1.3 Install Traefik hub-agent¶
1.4 Save the token¶
Save the token in a secure place!
Select Copy and save your token.
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.
4. Publish the service¶
Now, in the Traefik Hub UI, choose whoami
under services and select Publish the service.
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.
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.
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.
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.
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.
After a few moments, the ACP will be activated.
Browse to the URL of your demo application.
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.
- Learn about how to install and configure the Traefik Hub Agent for Docker and Kubernetes
- Understand Access Control Policies to secure the access