December 10, 2019 Cloud Native Building blocks

“The question is not whether Cloud Native will be a destination, then, but rather how one gets there.” – Stephen O’Grady, Redmonk

This article will introduce the building blocks of cloud native applications and how to create  cloud native applications. In this series so far, we have looked at cloud native -a simple definition

Cloud native apps are based on containers, service meshes, APIs and infrastructure which is immutable. They help in making the systems decouple from one another. The devops process is streamlined with the usage of cloud native platforms like docker.  The systems based on cloud native platforms have resilience, manageability and can be monitored easily.

Cloud native applications help ventures to execute and create scalable enterprise. These applications are deployed in public, private, and hybrid clouds. They can also be deployable in in-house environments.The building blocks of the cloud native platform are virtual server instances, block disk, object storage, fiber lines, VPNs, load balancers, cloud API, instance management and monitoring. Gartner has come up with the terms model 1 to refer to classic IT and model 2 to Cloud Native IT which makes the enterprise IT agile and adaptable.

As shown in the diagram below, containers, orchestrators, micro services, and user interface apps are the building blocks of cloud native applications.

Cloud Native Platform : Building Blocks

Containers are used for creating application packages. We have been using virtual machines for software packaging and deployment. You can execute the containers inside a virtual machine. Containers consist of libraries and processes and can help in reducing cost, speeding up deployment, and improving portability, scalability and security.  

Orchestrators are needed to execute the containers.  They can monitor and manage containers when needed as well as repair, bring up, and shut down the containers. Kubernetes is a popular orchestrator. Docker compose can also be used as an orchestrator tool.

Micro services are used to break down a complex system into multiple parts for scalability. Different teams can work independently to develop micro services architecture based software. The micro services based applications help to easily create cloud native applications.

Let’s look at creating a container using the popular container software docker. We will use the free community edition of docker.

Prerequisites:
1. You need to set up docker to run the commands below. You can download from this link.

Commands
You can start creating a docker by starting with a Java Hello World

public class HelloWorld {
    public static void main(String[] args) {
        System.out.println("Greetings From Docker");
    }
}

You can compile the java code by using the following command:

javac HelloWorld.java

You can execute the code to check for the output by using the command

java HelloWorld
Java Execution Output

The output of the command is shown below:

You can create a docker file as shown below

FROM alpine:latest
ADD HelloWorld.class HelloWorld.class
RUN apk --update add openjdk8-jre
ENTRYPOINT ["java", "-Djava.security.egd=file:/dev/./urandom", "HelloWorld"]

Docker container can built using  the below command.

docker build --tag "docker-greetings:latest"

Docker container is built as shown below:

Docker can be run using the docker run command as shown below.

docker run docker-greetings:latest

The output is shown below:

The list of containers running can be checked using the following command:

docker container ls -l

In the next part of the series, we will look at topics such as patterns, twelve-factor apps, data management and migration from monolithic to cloud-native applications.


bhagvanarch

Guest Blogger


categories & Tags


Close

Sign up for the Topcoder Monthly Customer Newsletter

Thank you

Your information has been successfully received

You will be redirected in 10 seconds