Walk through Running Traefik on Service Fabric Local Cluster

Developer Support

Premier Development Consultant Kurt Schenk provides a walk through to help you get up and running with Traefik on a Service Fabric Local Cluster.


In order to help you get up and running quickly to test Træfik and Service Fabric, this post will walk you through how to set this up on your local development cluster. There is good documentation at Running Træfik on Azure Service Fabric, but with a local development cluster you can skip some steps, and there are one or two snags I can help you avoid.

First off, why would you want to run Træfik on Azure Service Fabric? The reason is that Azure Service Fabric’s built-in reverse proxy is NOT recommended to expose APIs external to the cluster. Instead, Træfik and APIM are recommended by the Service Fabric product team (see Question – Azure Application Gateway with Service Fabric):

“At this point in time, there are a couple solutions available to you that don’t require you to write your own gateway service:

Azure API Management. APIM integrates with Service Fabric, meaning it has a Service Fabric back-end option that understands Service Fabric’s service discovery so it’s aware of services and how to discover their endpoints (works for stateful services too). If you end up having to manage a lot of front-end services, this could be a good option for you as APIM is specifically designed for that scenario.

Host a proxy server that can route traffic at L7. This is the direction we’re going with an integrated ingress proxy, but that’s still a few months out at least at this point. In the meantime though, take a look at running Traefik in your cluster, which integrates with Service Fabric and should be able to provide SSL termination and L7 traffic routing: https://docs.traefik.io/configuration/backends/servicefabric/

Azure Service Fabric Mesh will use Envoy, but still recommend Træfik, or APIM for Azure Service Fabric and Service Fabric Standalone (on premises).

So let’s walk through deploying Træfik to your local development cluster. First, switch your cluster mode to 1 Node. Otherwise deployment to your local development cluster will fail since the GitHub project as it is will try to start 5 instances of Træfik listening on port 80 if you use 5 Node cluster.

 

Machine generated alternative text: Manage Local Cluster Reset Local Cluster Start Local Cluster Stop Local Cluster Switch Cluster Mode Remove Local Cluster Exit 1 Node 5 Node

 

Now from Running Træfik on Azure Service Fabric you can choose where to deploy from, and for this walkthrough chose Visual Studio as described in Running Træfik on Azure Service Fabric >> Visual Studio.

 

1. Clone this repository to your local machine.

git clone https://github.com/jjcollinge/traefik-on-service-fabric.git

In my case, I just clicked on Clone or download

Machine generated alternative text: jjcollinge / traefik-on-service-fabric O Code O Issues 26 n Pull requests 2 Projects 2 reverse-proxy ED Wiki .11 Insights Azure Service Fabric now has support for Traefik! service-fabric azure azure-service-fabric m lcroserwces G) 145 commits V 7 branches ingress-controller 0 6 releases Create new file 14 contributors Upload files Find file Latest commi Clone or download jcollinge Merge pull request #79 from pregress/master

2. Download the Træfik binary into the solution by running the following PowerShell script.

./$REPO_ROOT/Traefik/Scripts/Get-TraefikBinary.ps1 -url $TRAEFIK_RELEASE

I chose v1.5.4, the latest stable release.

Machine generated alternative text: PS k\scri ptS> Review current Traefik releases: https : //gi thub.com/contai nous/traefi k/rel eases please provide the release tag (e.g. 'VI. 6. O-rc6' or 'VI. 5.4') of the Traefik release you Downloading Traefik Binary from: https : //gi thub.com/contai nous/traefi k/rel eases/downl oad/vl. 5.4/traefi k_wi ndows -amd64. exe Downloading Traefik watchdog Binary from: . \Get-Traefi kBi nary. PSI wish to download: VI. 5.4

3. Open the Traefik.sln file in Visual

4…8. Skipped these steps. The documentation says that if “working against a local development cluster or don’t require a secure cluster, skip to step 7.” But since step 7 is setting up TLS skipped that as well for local development cluster. Also skipped step 8 setting up watchdog service

9. You can now simply publish Træfik from Visual Studio like any other Service Fabric application

Right click on the project, select Publish and follow the wizard.

This will deploy Træfik to listen on port 80 for incoming traffic, and expose the Træfik dashboard on port 8080. But since there were system services listening on port 80 on my Windows 10 laptop this failed:

I had to first stop these services, which I did as follows:

Now when you publish it should work and in Service Fabric Explorer you will see this.

Machine generated alternative text: Search Cluster v Cluster v Applications v TraefikType v fabric:/Traefik v fabric:/Traefik/Traefik v 24ca17bb-26aa-44b7-9a25-7e47dd57d1f4 Node O v Nodes v _Node_O (Seed Node) > fabric:/Traefik > System

10. Skipped this step since not deploying to Azure Service Fabric, and instead to local development cluster.

11. Once the load balancer has been configured to route traffic on the required ports, you should be able to visit the Træfik dashboard at http[s]://[clusterfqdn]:8080 if you have it enabled.

For me deploying to local development cluster this was http://localhost:8080

Machine generated alternative text: roviders bric Health fabric:/Traefik/Traefik Server 131904963621634852 Load Balancer: drr VI .5.4 / cancoillotte URL http:/ /MININT- Documentation Weight 1 traefik.io QGT5D26. northamerica . c orp . microsoft . com:81/

 

 

Demo

Now, you can navigate to ./$REPO_ROOT/Traefik/Demos and run through demo as described in Running Træfik on Azure Service Fabric >> Demos >> routine.txt. For example, here is a screen shot as walking through demo of blue/green upgrade.

C:\Users\kurtsc\AppData\Local\Temp\msohtmlclip1\02\clip_image006.png

The demo described in routine.txt above also shows canary upgrade, distributing traffic between versions (25% progressively to 100%).

Now, after you have experimented a bit with Træfik on your Service Fabric local development cluster, it should make it easier for you to get up and running in Azure Service Fabric, or Service Fabric Standalone (on premises).

0 comments

Discussion is closed.

Feedback usabilla icon