Kubernetes for Scalability and High Availability in Microservices
Learn how Kubernetes works together with microservices and serverless to improve scalability and availability in your applications.
Join the DZone community and get the full member experience.Join For Free
Enterprise applications have to be designed upfront for scalability and change. This has significant implications for both application architecture and application infrastructure. Application architecture is evolving from unmanageable monolithic or three-tier patterns to interconnected microservices. Microservices introduce new form factors not only for functionality and team-size (the so-called two-pizza teams), but also for the unit of infrastructure. It is not surprising that a portable container or a pod of a handful of interrelated containers often works out as the most befitting unit of infrastructure for microservices-based architecture. Fortunately, container-based scalable infrastructure is a reality today, thanks to the Kubernetes project incepted in and open-sourced by in 2014. But for the sake of business agility, it is critical for enterprise development teams to focus on the business logic with the insurance that deployment onto a suitable infrastructure would be relatively painless.
Kubernetes in a Nutshell
Kubernetes is a deployment and orchestration framework for containerized applications. Given a farm of compute resources, Kubernetes allocates resources to containers and performs replication, scaling, failover, and other management tasks necessary to run enterprise applications reliably with efficient resource utilization.
The unit of deployment in Kubernetes is a 'pod'. A consists of one a small number of containers that are deployed and scaled together as a unit. A cluster consists of Nodes, which are compute resources that can join or leave a cluster. Pods can be deployed onto a running cluster using a deployment specification. Among other attributes, a deployment spec includes the desired state of the cluster in terms of the number of replicas of a pod that should be running at any point in time. The run-time ensures that the desired number of replicas is always maintained, even if one or more pods crash. Secondly, a deployment spec can be used to run rolling upgrades on the specified pods.
Let's break it down:
How Kubernetes, Microservices, and Serverless Work Together
- Componentization via Services
- Smart Endpoints and "dumb pipes"
Kubernetes is uniquely positioned to be the deployment platform of choice for Microservices. The 'components' of a microservices-based application can be developed, built, tested, deployed and scaled independently. Kubernetes uses containers, and containers enable application components to be portable and easily integrated in a larger application.
Microservices components — event-driven or otherwise, have to expose an interface for other components or the external world to access its services. This is where APIs have to be carefully defined, and an infrastructure for setting up and managing secure API endpoints has to be supported. LunchBadger brings together a development platform for microservices — both synchronous and event-driven (serverless) — with an API management framework, with end-to-end development and deployment support.
Over the next few posts, we'll cover tactical examples, guides and walk through how-tos so you can deploy a service in Kubernetes, understand and create a Kubernetes deployment spec, understand and create a Kubernetes Service Spec or just what Kubernetes is all about.
Published at DZone with permission of Al Tsang, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.