Like gardening, software development requires an understanding of how different elements work together to create a beautiful, productive ecosystem. That was the catalyst for our choice of a gardening theme for this year’s Microservices March program. As is the case with any garden, one problematic weed keeps creeping into the conversation: what is the difference between microservices and Kubernetes?
Plants are the main elements of a garden’s ecosystem. They are the living organisms that comprise your garden and contribute to its beauty and functionality. Similarly, microservices are the main building blocks of modern software applications. They’re the individual services that perform specific functions and work together to create a larger, more complex application.
Like plants, microservices vary in size, shape, and purpose. Some are small and specialized, tasked with one operation. Others are larger, more generalized in their operations, or comprised of a cluster of the smaller components. For example, a strawberry plant is small and only generates strawberries. This is akin to a microservice that only processes credit card transactions (small and specialized). A more generalized plant like cilantro produces not only the leafy greens used in salsa and guacamole, but also the coriander seed. This kind of plant is akin to a service that handles user authentication (a larger and more general process).
Most plants need to be planted in soil so they can draw nutrients and moisture – leave them bareroot and they’ll die. While it’s perfectly acceptable to put them straight into the ground, many gardeners opt for container gardening with pots because it lets them customize the soil, better defend against pests, and move plants around the garden (or even inside for the winter). Similarly, you have multiple options for where to put microservices, with the most common aptly being in a “container”. A containerized microservice includes everything you need to run the app, and it’s easily portable across runtime environments.
So we’ve got our microservices (plants) in our containers (pots) but how do we deploy, maintain, and scale them? With tools! Enter Kubernetes. Kubernetes provides many features and add‑ons that make it easier to manage and maintain microservices, and it’s considered the de facto tool for container orchestration. For example, Kubernetes provides automated load balancing, service discovery, and self‑healing capabilities (to take some of the maintenance and monitoring work off the shoulders of your Devs). And when everyone wants your microservices (plants) to produce more? Kubernetes supports automatic scaling and rolling updates to keep your microservice applications running smoothly.
We’ve established the case for using Kubernetes to manage microservices and prevent applications from growing wild and out of control. But Kubernetes and containers are not always necessary. Depending on the complexity of your application, you might instead choose to use a traditional virtual (or even physical) machine platform, which can still be deployed or provisioned using automation tools. These tools don’t provide the same level of automation and scalability as Kubernetes, but you might be okay with that tradeoff for less complicated or non‑critical apps. Another option is to use serverless computing platforms (such as AWS Lambda) that enable you to run your microservices code in response to events without worrying about the underlying infrastructure.
Savvy gardeners know that companion planting – for example, marigolds alongside tomatoes – makes better use of resources and contributes to a healthier garden. Similarly, Kubernetes provides a wide range of features and add‑ons that make it good for more than microservices management. Kubernetes can be used for non‑microservices apps (such as machine learning models or monoliths), for instance. We see a lot of customers using Kubernetes to manage microservices and other applications, with some even deploying virtual machines (VMs) inside Kubernetes! This can be a great option for organizations that are transitioning legacy monolithic apps to a microservices‑oriented architecture.
Getting to the Root of the Matter
We hope you take two things away from this post (aside from a hankering to visit your local nursery):
- Not everything deployed in Kubernetes is a microservice. The features and add‑ons Kubernetes provide make it a useful tool in a variety of ecosystems.
- Microservices don’t always need to be managed with Kubernetes. Some applications flourish with alternative tools and a “wild garden” approach.
Check out the following resources for more details about the fundamentals of microservices:
- Blog – Best Practices for Configuring Microservices Apps
- On-demand webinar – Fundamentals of Microservices
- On-demand training – Microservices March 2022: Kubernetes Networking
- On-demand training – Microservices March 2023: Start Delivering Microservices