Managing Service Lifecycles

Wercker is a Docker-Native CI/CD Automation platform for Kubernetes & Microservice Deployments

Twain Taylor
Twain Taylor
May 22, 2018

One of the key benefits of microservices is that each service can have its own lifecycle. In other words, each service can be built, deployed, monitored, and managed independently of other services.

However, managing independent lifecycles effectively can be challenging. It requires a new approach to application deployment. Let’s discuss what changes with the deployment of microservices apps, and identify some best practices for managing the lifecycle of microservices.


Release frequently

One of the biggest promises of microservices are that they speed up software delivery. For frequent deliveries to be possible, each release should follow the model of continuous delivery where releases are small and insignificant. This means you reduce the number of changes and updates in a single release, and aim for simple, focused releases. If you change one thing at a time, and a service fails, you know exactly what caused, it and where to look when troubleshooting. Additionally, you can easily rollback the release to the last stable version.


Automate at every step

Another keystone of continuous delivery is automation. DevOps starts by automating builds and testing, but it’s not complete till you automate releases as well. Your eventual goal should be to have code released automatically as soon as it is verified and ready for delivery. If you’re on AWS, a tool like CodeDeploy can help you manage the steps leading to the release.

Wercker’s pipeline feature lets you define an automation path along with configuration to deploy new containers on AWS ECS, or via Kubernetes. With Kubernetes, you can also take advantage of its rolling updates feature, which updates one pod at a time rather than taking down the entire service during an update. It can also automatically rollback to the last version if the update fails. And the best part is that all this happens without you having to lift a finger. Once configured, it applies to all your future updates.


Orchestrate containers

Microservices and containerization are like two sides of the same coin. But to run containers at scale, you need to leverage the power of an orchestrator. More specifically, Kubernetes is proving to be the de facto standard in container orchestration. Apart from rolling updates, Kubernetes has many other innovative features that make managing service lifecycles easier and more powerful.

The Replication Controller of Kubernetes provides automatic failover for pods in a cluster. It automatically starts up new replica pods when there are too few pods, and deletes replicas when there are too many.

Despite having such a dynamic pod lifecycle, Kubernetes cleverly abstracts away services from pods. In other words, even as the Replication Controller kills and starts pods under the surface, from a management perspective, the services remain discoverable and stable.


More autonomy for teams

A foundation change such as switching from a monolithic app to a microservices model isn’t just about changing the application stack. In fact, it starts with a change in the people and teams that are involved in the delivery lifecycle. From single-function teams to multi-function, microservices require teams to be autonomous and agile. With the lack of silos, decisions can be made quickly without having to get sign-off from another team.

The “You build it, you run it” mantra brings a sense of ownership to each micro-team. The more time they spend working on a single feature they become more familiar with it. This pays off especially in emergencies as teams are intimately aware of the services they own. They are able to spot errors fast, and resolve them fast. (Talking about emergencies, monitoring is critical to ensuring stable microservices management).


Monitor the user experience

With many changes to the application stack, the metrics monitored are different as well. There are many new metrics related to containers, and importantly, the volume and complexity of these metrics makes them particularly challenging. Fortunately, monitoring solutions have equally evolved.

Unlike before, where you could use a single monitoring tool, microservices require a suite of monitoring tools that specialize in one aspect of monitoring. Whether it’s application monitoring with New Relic, or log analysis with Sumo Logic, incident management with PagerDuty, and ChatOps with Slack—you can put together the best tools to get the widest and deepest view of your application. Despite the breadth of microservices, it’s important to not have blind spots, and be able to monitor everything, end-to-end.

Once you have your metrics in place, the final step is to closely correlate infrastructure metrics to user experience metrics. It’s one thing to know that three nodes are down in the “us-east-1” region, but more effective is to correlate it to the 200 customers for whom the billing service isn’t working. With all the change and newness of microservices, it’s easy to focus too much on the plumbing and forget the user experience. But microservices force us to think in terms of services, and focus on the user experience is necessary if microservices are to be successful.

Microservices bring a world of change to the software delivery lifecycle. It can be overwhelming to take it all in. But remembering these key principles can make it easier to manage microservices, and result in happier customers. At the end of the day, microservices are all about a better user experience.  


About the Author

Twain Taylor began his career at Google, where, among other things, he was involved in technical support for the AdWords team. His work involved reviewing stack traces, and resolving issues affecting both customers and the Support team, and handling escalations. Later, he built branded social media applications, and automation scripts to help startups better manage their marketing operations. Today, as a technology journalist he helps IT magazines, and startups change the way teams build and ship applications.


Topics: Product, Containers, Tutorials