Asterrr's Handbook

Cloud native principles

What "cloud native" means in the CNCF definition, microservices vs monoliths, immutability and declarative APIs, autoscaling with HPA, VPA, Cluster Autoscaler and KEDA, and serverless with Knative.

Exam tasks: 4.2 (cloud native ecosystem and principles: architecture characteristics, autoscaling, serverless)

The decision: which design property (loose coupling, immutability, declarative state, elastic scaling) does the scenario need, and which Kubernetes mechanism or CNCF project delivers it?

The CNCF definition in one line

The CNCF's official definition says cloud native technology helps you build and run scalable applications in dynamic environments: public, private and hybrid clouds. Its usual building blocks are containers, microservices, service meshes, declarative APIs and immutable infrastructure. The aim is loosely coupled systems you can operate, observe and recover easily, paired with automation so engineers can ship frequent, predictable changes with little toil.

Exam signal

If an option says cloud native "means running in a public cloud", it's wrong. Cloud native is about how applications are built and operated. It applies equally on premises.

Characteristics worth recognising

PrincipleWhat it means in practiceKubernetes expression
Declarative over imperativeYou state the end result; a controller works out the stepsYAML manifests applied to the API, reconciled by controllers
Immutable infrastructureNever patch a running instance; build a new image and replace itNew image tag, rolling update replaces Pods
Disposable, stateless processesAny instance can die and be replaced without losing dataDeployments with state kept in databases or volumes
Self-healingThe system notices drift and corrects itReplicaSets recreate Pods, probes restart containers
ElasticCapacity follows demand, both waysHPA, VPA, Cluster Autoscaler, KEDA
Resilient by designExpect failure: retries, timeouts, circuit breakers, multiple replicas across zonesTopology spread, PodDisruptionBudgets, service mesh policies
ObservableYou can understand the system from its telemetryPrometheus, OpenTelemetry
  • The phrase cattle, not pets sums up disposability: servers and Pods are numbered and replaceable, not named and nursed back to health.
  • The Twelve-Factor App guidelines predate Kubernetes but map well onto it: config in the environment (ConfigMaps, Secrets), logs as event streams (stdout), stateless processes, and dev/prod parity.

Monoliths and microservices

MonolithMicroservices
Deploy unitOne artifact for the whole appOne per service, released independently
ScalingScale everything togetherScale only the hot service
Failure blast radiusOne bug can take down the whole appContained to a service if designed well
DataOne shared databaseEach service owns its data
Complexity lives inThe codebaseThe network: discovery, latency, partial failure, tracing
  • Microservices trade code complexity for operational complexity. That's why they come with service discovery, service meshes and distributed tracing.
  • A small team with a simple app may be better off with a well-structured monolith. The exam rewards knowing the trade-off, not "microservices always".

Microservices sharing one database

Splitting an app into services that all read and write the same tables keeps the coupling and adds network hops. Loose coupling means each service owns its data and talks to others through APIs or events.

Autoscaling

AutoscalerScalesDriven byWhere it comes from
HPAReplicas of a Deployment or StatefulSetCPU and memory utilization, or custom and external metricsBuilt into Kubernetes (autoscaling/v2)
VPACPU and memory requests of PodsObserved usage historyAdd-on from the Kubernetes autoscaler project
Cluster AutoscalerNodes in node groupsPods stuck Pending for lack of capacity, and underused nodesAdd-on, works with cloud provider node groups
KarpenterNodes, picked to fit pending PodsPending Pods, consolidationKubernetes SIG Autoscaling subproject
KEDAReplicas, including to and from zeroEvent sources: queue depth, Kafka lag, cron, Prometheus queriesCNCF graduated project, drives an HPA under the hood
  • HPA utilization targets are a percentage of the Pod's requests. With no CPU request set, a CPU target has nothing to compare against.
  • HPA and VPA should not both act on the same CPU or memory metric for one workload; they fight each other.
  • Node autoscalers react to Pending Pods, not to high CPU on existing nodes. Pod autoscaling creates the Pods; node autoscaling makes room for them.
  • In-place Pod resize (changing a running container's CPU and memory without recreating the Pod) became stable in Kubernetes v1.35, which lets vertical scaling avoid restarts in many cases.

Exam signal

"Scale workers to zero when the queue is empty and back up when messages arrive" is KEDA. Plain HPA keeps at least one replica by default.

Serverless and Knative

  • Serverless means you supply code or a container and the platform handles servers, scaling (including to zero) and often per-request billing. Functions as a Service (FaaS) is one form.
  • Knative (graduated) brings serverless to Kubernetes. Knative Serving runs request-driven containers with revisions, traffic splitting and scale to zero. Knative Eventing routes events between producers and consumers.
  • CloudEvents (graduated) is the CNCF specification for describing event data in a common way, so events can move between platforms. Knative Eventing uses it.
  • Trade-offs: cold starts after scaling to zero, limits on run time, and less control over the environment.

Scenarios

Scenario
Which statement best reflects the CNCF view of cloud native?
Scenario
An HPA at Quillfeather Analytics has scaled a Deployment to 30 replicas, but 8 Pods stay Pending with the message that no nodes have enough CPU. What adds capacity automatically?
Scenario
A team deploys a fix by SSHing into nodes and editing files inside running containers. Which cloud native principle does this break most directly?

Further reading

On this page