Cloud Native Architecture Fundamentals
By: Rupesh Patel
Tags: Engineering, Cloud Native Application, Microservices, Architecture Design, The Twelve Factor App

Overview of Cloud Native

Cloud-Native became the buzzwords in a very short time and the biggest trends in the software industry but before we even talk about the Cloud-Native application, let’s first understand more about cloud computing fundamentals.

In simple terms, cloud computing is the delivery of computing services — including servers, storage, databases, networking, software, analytics, and intelligence — over the Internet (“the cloud”) to offer faster innovation, flexible resources, and economies of scale. You typically pay only for cloud services you use, helping you lower your operating costs, run your infrastructure more efficiently, and scale as your business needs changes. Typically, you use cloud computing in three ways IaaS, PaaS and SaaS. For the scope of this blog, the above information should be sufficient to get started.

Cloud-Native is the way or approach to build and deploy applications that take great advantage of cloud computing services using various cloud computing models. The Cloud-Native principles and architecture help you to build Apps faster, better and shorten the path to production. it is about achieving overall speed, scale, agility and competitive advantage.

Unlike the continuous hype that drives our industry, Cloud-Native is for-real. Considering the Cloud-Native Computing Foundation (CNCF), a group of more than 200 major corporations with a charter to make Cloud-Native computing ubiquitous across technology and cloud stacks. As one of the most influential open-source groups, it hosts many of the fastest-growing open-source projects in GitHub. They include projects such as Kubernetes, Prometheus, Helm, Envoy and gRPC.

Four Key Pillars of Cloud Native Architecture

1. Microservices

Cloud-Native systems embrace Microservices, a popular architectural style for constructing modern applications. Built as a distributed set of small, independent services that interact through a shared fabric. Microservices share the following characteristics:

Domain orientated approach to implements a specific business capability within a larger domain context.

Each Microservice should be developed and deployed autonomously and independently.

Each Microservice is self-contained, encapsulating its own data storage technology (SQL, NoSQL) and programming language/tools.

Each Microservice runs in its own process and communicates with others using standard communication protocols such as HTTP/HTTPS, gRPC, WebSockets, or AMQP.

2. Container

Nowadays, containerization has become a very popular technology for deploying apps. The container provides portability and guarantees consistency across environments. By encapsulating everything into a single package, we isolate the Microservice and its dependencies from the underlying infrastructure.

Kubernetes/K8s is a container orchestration and management system built by Google. When operating at scale, container orchestration is essential. Scheduling, Networking, Monitoring, Failover etc is a common orchestration task of an orchestration engine.

3. DevOps

DevOps creates a culture and an environment where building, testing, and releasing software happens rapidly. It helps you in automating the process of platform provisioning and application deployment. Hence, it makes infrastructure and deployments consistent and gives a repeatable characteristic. Cloud-Native apps should be managed by DevOps tools like Jenkins, Dockers and Kubernetes.

4. CI/CD

Continuous Integration and Continuous Delivery helps you in making frequent releases and speedup the go-to-market process. At the same time, this enables you in moving incremental software changes into production constantly through automation. Continuous delivery makes the act of releasing software robust and reliable so that, organizations can deliver software more frequently with less risk and get customer feedback faster.

Best practices and guidelines for implementing Cloud-Native applications

Modern Design, the 12 — Factor app

1. Codebase — One codebase tracked in revision control, many deploys

2. Dependency — Explicitly declare and isolate dependencies

3. Configurations — Store configuration in the environment

4. Backing Service — Treat backing services as attached resources

5. Build, release, run — Strictly separate build and run stages

6. Processes — Execute the app as one or more stateless processes

7. Port binding — Export services via port binding

8. Concurrency — Scale-out via the process model

9. Disposability — Maximize robustness with fast startup and graceful shutdown

10. Dev/prod parity — Keep development, staging, and production as similar as possible

11. Logs — Treat logs as event streams

12. Admin processes — Run admin/management tasks as one-off processes

API is the only medium for apps to communicate

Apps communicate using APIs. When you’re building an application, we should think about how it will be consumed by applications running in the same ecosystem, and start by designing an API strategy. A good API design makes the API easy to be consumed by app developers and external stakeholders. It’s a good practice to start by documenting the API using the OpenAPI specification before you implement any code. Some of the good open source tools are APICURIO, Swagger, etc can be leveraged for designing and development.

Authentication and Authorization

Security is a wide area to cover as it includes operating systems, networks and firewalls, data and database security, application security, and identity and access management. But here let’s focus on security from an application’s point of view. APIs provide access to the applications in your enterprise ecosystem. You should therefore ensure that these building blocks address security considerations during the app design and build process.

Data in transit: Use TLS1.2 to help protect data in transit. You might want to use mutual TLS for your business applications. This is made easier if you use service mesh like Istio/Linkerd on Kubernetes Engine.

Application and end-user security: Transport security helps in providing security for data in transit and establishes trust. But it is a best practice to add application-level security to control access of your app based on who the consumer is. The consumers can be other apps, UI, vendors, partners, etc. You can enforce security using API keys (for consuming apps), certification-based authentication and authorization, JSON Web Tokens (JWTs) exchange, or Security Assertion Markup Language (SAML). OAuth 2.0 is the industry-standard protocol for authorization.

Some of the Critical Design considerations

Beyond the guidance provided from the twelve-factor methodology, there are several critical design decisions one must make when designing a distributed system.

Resiliency: In a distributed architecture, what happens when Service B isn’t responding to a network call from Service A? Or, what happens when Service C becomes temporarily unavailable and other consumers’ services are blocked?

Service to service communication: How will front-end client and any consumer applications communicate with backed-end core services?

Will you allow direct communication or, will you abstract the back-end services with a gateway façade that provides flexibility, control, and security?

What is the right way for back-end core services to communicate with each other?

Will you allow direct HTTP calls that lead to coupling and impact performance and agility? Or will you consider implementing the event-driven architecture and decouple the services using streaming platforms like Kafka or RabbitMQ.

Data distribution: In Microservices, by design, each Microservice encapsulates its own data which means each service has its own database allowing operations via its publicly exposed interface using API. If yes, how do you query data or implement a transaction across multiple services?

Cloud-Native deployment is the way forward to achieve business growth and flexibility in today's Multi-Cloud environment.

Thanks and happy learning!!