DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’» is a community of 963,274 amazing developers

We're a place where coders share, stay up-to-date and grow their careers.

Create account Log in
Cover image for Kubernetes Learning Part I - Application Architecture Decision and Purpose of K8s
Saravanan Gnanaguru for Kubernetes Community Days Chennai

Posted on • Updated on • Originally published at dev.to

Kubernetes Learning Part I - Application Architecture Decision and Purpose of K8s

Kubernetes Learning Series - Part I

Table of Content

Introduction

  • We will have a look into the important concepts of Application architecture concepts and when to choose Kubernetes while designing the application.
  • This blog is part of Kubernetes learning series.

Monolithic Architecture vs Microservice Architecture

Application architecture has been divided into two major architecture patterns,

  • Monolithic - Application with tightly coupled components
  • Microservice - Application divided into multiple components and accessed via APIs

We will discuss these patterns in detail.

Monolithic

  • Monolithic architecture is traditional approach and has tightly coupled components
  • Let us consider a scenario for Monolithic architecture,
    • If there are 10 modules in a monolithic application, then we have to develop, package and deploy the modules as one single package
    • In case, if there is a change in one module, then we have to fix or develop the module changes and can deploy it only along other modules Hence this approach is tedious and difficult adopt for a fast growing environment

Microservice

  • On contrast, Microservice architecture has independent modules and can have the development and deployment of the modules happen separately without having to deploy other modules
  • In the example of 10 modules application explained above,
    • Each module will be exposed as a separate REST API and it interacts with UI module
    • Since we separate all the modules as REST API, it is easy to deploy specific module, if there are any changes
  • So the modules can be containerised and orchestrated using kubernetes

What is Kubernetes

  • Kubernetes (also called a K8s) is a Container orchestration open-source platform.
  • Kubernetes builds upon 15+ years of experience of running production workloads at Google, combined with best-of-breed ideas and practices from the community.
  • We can manage containerised workloads and services, that facilitates both declarative configuration and automation.
  • It has a large, rapidly growing ecosystem. Kubernetes services, support, and tools are widely available.
  • Refer Documentation for more details

Purpose and features of Kubernetes

  • Infrastructure created using containers has been immutable in nature. So It means, if there’s a change in application every time we will have to rebuild and re-deploy the changes into application and services to create app containers. Then it can be orchestrated using kubernetes config files
  • Major purpose of Kubernetes is container orchestration and it has below features,
  • Service discovery and load balancing: Kubernetes can expose a container using the DNS name or using their own IP address. If traffic to a container is high, Kubernetes is able to load balance and distribute the network traffic so that the deployment is stable.
  • Storage orchestration: Kubernetes allows you to automatically mount a storage system of your choice, such as local storages, public cloud providers, and more.
  • Automated rollouts and rollbacks: You can describe the desired state for your deployed containers using Kubernetes, and it can change the actual state to the desired state at a controlled rate.
  • Automatic bin packing: You provide Kubernetes with a cluster of nodes that it can use to run containerised tasks. You tell Kubernetes how much CPU and memory (RAM) each container needs. Kubernetes can fit containers onto your nodes to make the best use of your resources.
  • Self-healing: Kubernetes restarts containers that fail, replaces containers, kills containers that don't respond to your user-defined health check.
  • Secret and configuration management: Kubernetes lets you store and manage sensitive information, such as passwords, OAuth tokens, and SSH keys.

Stateless Application

  • A stateless process or application can be understood in isolation. There is no stored knowledge of or reference to past transactions. Each transaction is made as if from scratch for the first time.
  • An example of a stateless transaction would be doing a search online to answer a question you’ve thought of. You type your question into a search engine and hit enter.
  • If your transaction is interrupted or closed accidentally, you just start a new one. Think of stateless transactions as a vending machine: a single request and a response.

Stateful Application

  • Stateful applications and processes, are those that can be returning transactions from various application services like online banking or shopping applications.
  • They’re performed with the context of previous transactions and the current transaction may be affected by what happened during previous transactions. For these reasons, stateful apps use the same servers each time they process a request from a user.
  • The majority of applications we use day to day are stateful, but as technology advances, microservices and containers make it easier to build and deploy applications in the cloud.

Conclusion

In this article we have seen why and when to choose kubernetes based architecture, while designing the application.

This article previously published on my dev community personal profile, re-publishing for the benefit of a wider audience.

Hope this article is helpful to people getting started with kubernetes.

Thanks for reading!

Heads up for Next Blog

We will see Kubernetes architecture and installation to getting start with Kubernetes

Follow me and share your thoughts,

Bibliography

Top comments (0)

🌚 Friends don't let friends browse without dark mode.

Sorry, it's true.