Traefik is an open source API gateway, written in Golang and was developed in a Unix-centric way. It is designed to simplify the complexity regarding microservices operations. Traefik performs auto-configuration of services, which means that the developer only needs to worry about developing and deploying applications.
Traefik auto-configures with sensible defaults and sends a request to the said service. With changing requirements and needs of various microservices, it takes care of its services by following a pluggable architecture.
Traefik supports major technologies such as Docker, AWS, Kubernetes, Mesos and Marathon. These engines have their own integration points called providers. It does not require a static configuration file. The providers are responsible for connecting to the orchestration engine and determining the services running on it. It then provides this information to the Traefik server, which can apply this to its routing.
Traefik can integrate with multiple providers at the same time.
With nginx as a competitor in the market, Traefik is still able to make its way gradually to the top by providing better features with monitoring and observability and support for protocols.
Go to: Traefik-Release and download the suitable version available.
Unpack the archieve: tar -zxvf <file-name>.
The folder contains a traefik executable with two other files.
First, let’s validate the version of Traefik.
This output displays the Traefik version with information related to the platform and the date on which the Traefik binary was created.
In general, the traefik command has the following syntax:
traefik [command] [flags] [arguments]
In this command, all the arguments are optional.
Let’s start traefik.
INFO Configuration loaded from the flags.
The command start listening at port 80. Lets hit a curl request to localhost to verify.
curl -i http://localhost/
The cURL request gets a 404 page not found response from the server. This is the default response we should get out of Traefik.
Most importantly, Traefik provides REST API which accesses all the information available in it. These APIs are reachable on port 8080
Traefik dashboard displays the status of all components configured in it.
The dashboard shows TCP and UDP services. These are two listening ports with HTTP based applications.
Adoption of microservices have changed the requirements from API gateway. Established market products such as Nginx and HAProxy have tried to adapt these features but still lack in providing the first-class support of all needs.