Over the last few years, Docker and software container systems have become the industry standard for packaging and deploying applications. A consequence of this trend has been the development of container orchestration systems like Kubernetes and Apache Mesos. Microsoft Azure has entered the space with its own comprehensive system orchestration and management system, Azure Service Fabric.
What exactly is the value-add for Service Fabric? How do we use it to solve container-related technical challenges? This course answers both of those questions and goes even further by covering a number of relevant software design concepts. From this course, you will learn what Service Fabric does, how to use it to deploy a real application, and how Service Fabric incorporates design patterns and structures such as the actor model and collections.
By the end of the course, you should be ready to work with a team using Azure Service Fabric to create a working application.
- Use Azure Service Fabric to solve infrastructure orchestration challenges
- Learn about software concepts relevant to Service Fabric, including collections, the actor model, and stateful vs stateless services
- Deploy an application to a Service Fabric cluster
- People looking to build applications using Microsoft Azure
- People interested in container orchestration systems
- General knowledge of IT architecture
- General knowledge of software containers
How do we use Service Fabric? Our goal in this lesson is to understand more concretely how one actually uses Service Fabric. To explain this, we'll divide this lesson into two parts. Firstly we'll go over Service Fabric's specific feature list, all of the things we can actually do with it. And then secondly we'll do a walkthrough of an actual application deployment. We'll take an example Linux application and go through the steps to use Service Fabric to get that application up and running.
So let's start with the list of features. Service Fabric does a lot of things. At a high level, there are basically two core features, container orchestration and environment optimization. The former concerns things like hardware provisioning, cluster configuration, container deployment, application upgrading, and service creation. Service creation itself entails a lot of complexity including things like SSL certificates, DNS names, exposing ports, firewall rules and other details relevant to defining a reliable software service. Now in that second category, environment optimization, are features like cluster scaling, disaster recovery, load balancing, and monitoring. This second category of features concerns everything that happens after an application has been successfully defined and deployed.
So, in short, Service Fabric, like Kubernetes, lets us define a container-powered application cluster, deploy it and then maintain and optimize it. Now we're not gonna drill down to the level of CLI commands or API calls. For that level of fine-grain detail, we refer to Azure's excellent documentation. Check the links with this video if you're ready to start reading. More interesting to us is working out how to actually start using Service Fabric.
So now that we have some basic sense of the feature set, let's walk through creating a service. We're not doing a full demo here. That will come in section three. Instead, we'll just go through the steps. From start to finish there are five basic steps. One, set up Azure tools. Two, set up the application package. Three, create the Service Fabric cluster. Four, create environment configuration. And five, deploy the application.
So for step one, the first thing you need is, of course, an Azure account. Once you have a working account, you can set up your local development environment or work primarily through the web UI. Familiarity working with terminals and CLI tools is extremely helpful here. One of the fastest ways to work with Service Fabric is to just use the Azure Cloud Shell. You can launch it directly from the web portal and instantly have a terminal environment with all of your needed tools and credentials preconfigured. Once you have that set, you're ready for step two.
Now for step two, we have to decide what application we're actually going to run. Remember that for Service Fabric the application must take the form of a container. So how can we get an application container we can use with our cluster? If you have some programming experience, you could create your own simple app and manually create a container using something like Docker. Service Fabric will need manifest files to tell it what containers to download. Fortunately, there are also many sample applications and manifest files publicly available on GitHub. See the link on the side for details.
Now next we have to actually create our Service Fabric cluster and there are a couple of ways to do this. We may designate a specific set of nodes in an on-premises solution if you have your own data center. If we're using a provider like Azure, we'll be creating virtual server instances. In the past, Azure had a feature known as party clusters that let you use Microsoft's own preexisting nodes for test purposes. However, that service was discontinued recently. Now the simplest approach is creating our own nodes in a provider, in this case, Azure.
So for step four which is crucial because it will allow us to actually do the work with the cluster, we're going to configure our Azure Cloud Shell to use the cert we downloaded so that it can talk to the cluster. And it's also a good idea to set up the Service Fabric Explorer. This is an optional tool that lets you inspect and visualize your Service Fabric system. So now from step three, we have our nodes and in step four we have our configuration.
And then finally in step five, we're going to deploy the application from step two into the cluster from step three using the configuration from step four. You will first connect to the cluster using the shell. You'll run a command that takes the certificate file as an argument for authentication purposes. Once connected, you can just run the install script and that should be included with your application. It should handle downloading the appropriate image, setup app configuration and then running the actual program.
Now in the real world, there are a lot of intermediate steps that we're skipping over here. To create a proper service reachable from the public internet, a lot of infrastructure needs to be set in place. Things like firewall rules, DNS names to name a few. With the right configuration in place, Service Fabric will wire together much of this stuff for you. Still, it's important to understand what's going on under the hood. One of the biggest risks when using tools like Service Fabric or Kubernetes is that they create an abstraction layer over your infrastructure that can make it hard to understand what's actually going on. This is especially problematic when things go wrong or you have an outage.
So with that in mind, that's where we'll stop for this section. You should now have a pretty solid grasp of what Service Fabric does and why it may be useful. The Service Fabric official documentation is a great source if you wanna drill down further. We won't be focusing again on Service Fabric itself until section three where we get into the hands-on work. In section two, the next section, we're gonna go over a couple of important application design concepts relevant to working with Service Fabric. We'll see you there.
About the Author
Jonathan Bethune is a senior technical consultant working with several companies including TopTal, BCG, and Instaclustr. He is an experienced devops specialist, data engineer, and software developer. Jonathan has spent years mastering the art of system automation with a variety of different cloud providers and tools. Before he became an engineer, Jonathan was a musician and teacher in New York City. Jonathan is based in Tokyo where he continues to work in technology and write for various publications in his free time.