Kubernetes and the Need to Become Cloud Native and 12-Factor Compliant

Anselmo Abadía
Flux IT Thoughts
Published in
3 min readApr 30, 2020

--

Ensuring the quality of our developments and the welfare of the applications we create is a principle that, as fluxers, defines us. That is why we decided that all our developments will be guided by cloud native and 12-Factor concepts.

What Is a Cloud-Native Application?

An application isn’t cloud native when it runs in a cloud service, like AWS, but when it runs in any kind of cloud. It doesn’t only refer to microservices or Kubernetes: it is a paradigm that entails practices, tools and infrastructure for our application to run in any cloud, both public or private, improving aspects such as availability, reliability, scalability, among others.

It has to do with the way our applications are built and deployed, no matter where. The more portable our development among different providers is, the higher the maturity level of our application regarding Cloud Native.

What is 12-Factor?

12-Factor is a work methodology created by Heroku developers, aimed at building SaaS applications in the best way, following a series of principles.

This methodology was introduced through a manifesto published in 13 languages, in which the goals that “12 Factor” seeks to achieve are explained:

  • Explicit and automated setups.
  • Clear contract with the environment, offering maximum portability.
  • The application is suitable for deployment on the cloud.
  • Continuous deployment.
  • Applications focused on scalability.

The 12 Factors:

Now I’ll show you how we understand the 12 factors at Flux IT and which are the main keywords we assign to each of them¹:

  1. Codebase: the codebase must be managed through a branching scheme and tracked in revision control.
    Keywords: Git, GitFlow, traceability, semantic version.
  2. Dependencies: All of the application’s dependencies must be explicitly declared and there must be a system to install them.
    Keywords: Maven, Npm, Artifactory.
  3. Config: The application’s config must be factored out of the bundle resulting from compiling the source code.
    Keywords: environment variable, externalized configuration, ConfigMaps.
  4. Backing services: backing services must be treated as databases or volumes with commodities, thus avoiding the vendor lock-in.
    Keywords: RDS, Kubernetes Volumes.
  5. Build, release, run: the application’s build and run stages must be strictly separated.
    Keywords: independent pipelines for each stage, a single bundle regardless of the environment.
  6. Processes: the app must be executed as one or more stateless processes.
    Keyword: Stateless.
  7. Port binding: the app must be self-contained and expose services via port binding. This means that it does not rely on an external application server.
    Keywords: Docker, Spring Boot.
  8. Concurrency: The app must scale out via the process model, assigning this task to the process manager.
    Keywords: Kubernetes, Docker Swarm.
  9. Disposability: robustness must be maximized, aiming for fast startup and graceful shutdown. The processes can be started or stopped at a moment’s notice.
    Keywords: Kubernetes Deployments, Microservices.
  10. Dev/prod parity: keep development, staging, and production as similar as possible. Homogenize environments and the use of mocks as much as possible.
  11. Logs: logs must be treated as event streams and the application shouldn’t concern itself with the storage of this information.
    Keywords: Observability, ELK, Grafana, Prometheus, Loki, stdout.
  12. Admin processes: Run admin/management tasks as one-off processes. Automate everything, even the database scripts.
    Keywords: Liquibase, Kubernetes Job.

Why Are These Features Important and How Do They Relate to Kubernetes?

Kubernetes is a container orchestrator platform. It is currently in the lead and it beat the rest of the tools. The use of K8s OnPremise, for instance with OpenShift or on Cloud (as EKS, AKS or GKS) encourages us to evolve our developments in order to deploy them on those platforms.

When the applications are Cloud-native and they comply with the 12 factors, everything is easier.

Infrastructure changes: It becomes relatively simple to move our application to different clusters. For example, moving an on-prem cluster to another K8s cluster in the cloud, such as EKS from AWS.

Deployments: Deploying applications and updates becomes a regular task, thus avoiding service degradation. For example, by performing a proper Blue/Green deployment with Kubernetes.

Scaling: the independence between our application and the computation capacity allows concepts such as horizontal and vertical scaling to be possible. Auto-scaling is another way of meeting the demand peaks while reducing costs.

Thus, developments become more reliable and sustainable with a lower maintenance cost.

¹ https://12factor.net/

Know more about Flux IT: Website · LinkedIn · Breezy · Instagram ·Twitter · Dribbble

--

--