Microservice architecture, also known as ‘microservices,’ is a development method that breaks down software into modules with specialized functions and detailed interfaces.
The monolithic architecture consists of applications built as large, autonomous units. Such applications cannot be changed easily because the entire system is heavily interconnected. Even a tiny modification to the code is likely to require creating and deploying a completely new version of the software. Monolithic applications are also difficult to scale, as scaling a specific function would require scaling the complete application.
Microservices address these problems of monolithic architecture by taking a modular approach to software development. In simple terms, microservices reimagine applications as a combination of multiple individual, interconnected services. Each service runs a specialized process and is deployed independently. If needed, the services can store and process data using different techniques and can be written in other programming languages.
Microservices architecture using a simple web application. We will then try and deploy this web application on multiple different kubernetes platforms.
This is a sample voting application which provides an interface for a user to vote and another interface to show the results. The application consists of various components such as the voting app, which is a web application developed in Python to provide the user with an interface to choose between two options Dog and Cat, When you make a selection, the vote is stored in Redis, Redis serves as a database in memory.
This vote is then processed by the worker, which is an application written in dot net. The worker application takes the new vote and updates the persistent database, which is a PostgreSQL.
In our case, the PostgreSQL simply has a table with a number of votes for each category Dog and Cat. Finally, the result of the vote is displayed in a web interface, which is another web application developed in Node.js. This resulting application reades the count of votes from the Postgres SQL database and displays it to the user.
So that is the architecture and data flow of this sample voting application stack. As you can see, this sample application is built with a combination of different services, different development tools and multiple different development platforms such as Python, Node.js, dot, net,
So we already know how the application works and it's a good idea to write down what we plan to do. So our goal is to deploy these containers, these applications as containers on a Kubernetes cluster, and then enable connectivity between the containers so that the applications can access each other and the databases and then enable external access for the external facing applications which are the voting and the result app so that the users can access the web browser.
So how do we go about this? Now we know that we cannot deploy containers directly on Kubernetes. We learned that the smallest object that we can create on a Kubernetes cluster is a pod. So we must first deploy these applications as a pod on our Kubernetes cluster. Or we could deploy them as replica assets or deployments as we have seen through throughout this course. But at first, for the sake of simplicity, we will stick to pods in this lecture, and later we will see how to easily convert that to a deployment.