Deploying our application in a microservices manner inside a cluster is simple enough in principle, but actually quite complex to implement.
First, you must provision servers to act as nodes inside your cluster. Then, we'll need to set up a handful of tools that work in concert with each other to manage your cluster. These tools can be categorized into two groups:
- Cluster-level tools: Works at the cluster level, and makes global decisions that affect the whole cluster
- Node-level tools: Resides within each node. It takes instructions from, and feedback to, cluster-level tools in order to coordinate the management of services running inside the node.
For the cluster-level tools, you'll need the following:
- A scheduler: This dictates which node a particular service will be deployed on.
- A Discovery Service: This keeps a record of how many instances of each service are deployed, their states (for example, starting, running, terminating and so on.), where they're deployed, and so on. It allows for service discovery.
- A Global Configuration Store: Stores cluster configurations such as common environment variables.
On the node-level, you'll need the following tools:
- Local configuration management tools: To keep local configuration states and to synchronize with cluster-level configurations. We have our cluster configurations stored inside the Global Configuration Store; however, we also need a way to retrieve those settings into each node. Furthermore, when those configurations are changed, we need a way to fetch the updated configuration and reload the application/services if required. confd (https://github.com/kelseyhightower/confd) is the most popular tool.
- Container runtime: Given that a node is assigned to run a service, it must have the necessary programs to do so. Most services deployed on modern microservice infrastructures use containers to encapsulate the service. Therefore, all major cluster management tools will be bundled with some kind of container runtime, such as Docker.
Now, let's take a look at each cluster-level tool in more detail.