KUBERNETES · KCNA · CHAPTER 10

Cloud Native Application Delivery

From commit to production with no manual steps, with Git as the single source of truth.

15 min readKCNA domain: Cloud Native Application Delivery (16%)Level: beginner

From point A to point B

Point A: you know how to build, secure, connect, scale and observe applications on Kubernetes, but every change still needs someone to run commands. Point B: by the end of this chapter you'll understand how a change travels from commit to production automatically and safely, and what to do when an application fails.

This is the last chapter of the course, and it covers the Cloud Native Application Delivery domain (16% of the KCNA exam): delivering applications and debugging them.

From manual releases to CI/CD

In the past, teams merged their code every few weeks, tested it by hand and deployed it on a "release night" a few times a year. Every release was big, slow and risky, and when something broke it was hard to tell which change had caused it.

CI/CD automates that whole path:

  • Continuous integration (CI): every commit is merged into the main branch and automatically triggers the build and the tests. Errors show up within minutes.
  • Continuous delivery (CD): whatever passes the tests is packaged, for example as a container image, and ready to deploy at any time.
  • Continuous deployment: the final step, deploying to production, is automatic too.
From manual releases to CI/CD Before: code was merged rarely, tested and deployed by hand, a few times a year, with long and risky releases. With CI/CD, every commit goes through an automated pipeline: build, test, package and deploy, many times a day, in small and safe steps. BEFORE · manual, a few times a year code merge (weeks) manual tests release night risky, slow CI/CD · automated, every commit CONTINUOUS INTEGRATION CONTINUOUS DELIVERY / DEPLOYMENT commit build test package deploy monitor feedback in minutes · small changes · easy rollback

With CI/CD, every commit goes through an automated pipeline. Diagram: The House of Routing.

# .github/workflows/ci.yml in the application repository
name: ci
on:
  push:
    branches: [main]
jobs:
  build:
    runs-on: ubuntu-latest
    permissions:
      contents: read
      packages: write
    steps:
      - uses: actions/checkout@v4
      - run: make test                                   # 1. test
      - run: docker build -t ghcr.io/thor/shop:${{ github.sha }} .   # 2. build
      - run: |                                           # 3. publish
          echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
          docker push ghcr.io/thor/shop:${{ github.sha }}
      # 4. a last step opens a pull request in the config repository
      #    that changes the image tag to this commit

What GitOps is

GitOps uses Git repositories as the central, reliable source of truth for delivering infrastructure as code. All of the cluster's configuration, meaning its Deployments, Services, Ingress and ConfigMaps, lives in Git.

The golden rule: changes go to the repository, never straight to production. Nobody runs kubectl apply by hand. An agent inside the cluster reads Git and applies what it finds. The benefits are clear:

  • Every change is recorded: who made it, when and why.
  • Changes are reviewed through pull requests, just like code.
  • Rolling back is as easy as reverting a commit.
  • Rebuilding an entire cluster just means pointing the agent at the same repository.

The four principles of GitOps

Within the CNCF, the GitOps Working Group created the OpenGitOps project so that vendors, end-user companies and the open source community could agree on what GitOps is and what its best practices are. Its definition comes down to four principles:

The four OpenGitOps principles First, declarative: the desired state is described, not scripted. Second, versioned and immutable: that state lives in Git, with full history. Third, pulled automatically: agents fetch the desired state themselves. Fourth, continuously reconciled: agents keep comparing the real state with the desired one and correct any drift. 1 · DECLARATIVE the desired state is described in YAML, not as a list of commands 2 · VERSIONED AND IMMUTABLE stored in Git with full history; a change is a new commit 3 · PULLED AUTOMATICALLY agents such as Argo CD or Flux fetch the desired state themselves 4 · CONTINUOUSLY RECONCILED real state ≠ desired state? the agent corrects the drift

The four principles of OpenGitOps. Diagram: The House of Routing.

  1. Declarative: the system is described by its desired state, in YAML files, not by a list of commands.
  2. Versioned and immutable: that state is stored in Git with its full history. To change something, you make a new commit; you don't rewrite what came before.
  3. Pulled automatically: agents such as Flux or Argo CD fetch the desired state themselves (that's the pull) and deploy it on their own, with no human intervention and none of the human errors.
  4. Continuously reconciled: the agents constantly compare the actual state with the desired one. If someone changes something by hand, they detect it, alert you and fix it.
Familiar from chapter 1. It's the same Kubernetes control loop, which compares the actual state with the desired one and corrects it, but taken one level higher: the desired state no longer lives only in etcd, but in Git.

Push and pull deployment

Deploying means releasing a new version to users, and it always involves building, testing and deploying. What changes is who takes the last step:

Push-based and pull-based deployment In push-based deployment, the CI/CD system outside the cluster holds the cluster credentials and pushes changes with kubectl or helm. In pull-based deployment, an agent such as Argo CD or Flux runs inside the cluster, watches Git and the registry, and pulls the changes. The cluster credentials never leave the cluster. PUSH-BASED GIT commit CI/CD SYSTEM holds the cluster credentials ⚠ kubectl CLUSTER receives changes from outside PULL-BASED · GitOps GIT desired state CLUSTER ARGO CD / FLUX agent inside apps pull + compare credentials stay inside the cluster

With push, the credentials leave the cluster; with pull, they stay inside. Diagram: The House of Routing.

  • Push: an external system, the CI/CD one, pushes the changes to the cluster with kubectl or helm. To do that it needs read and write access, so the cluster's credentials are exposed outside it, in the CI/CD system. If that system is compromised, so is the cluster. Those credentials need to be rotated often.
  • Pull: all changes are made from inside the cluster. An agent, such as Flux, Argo CD or Jenkins X, checks the Git repository and the image registry at regular intervals and applies anything new. The big advantage is security: the credentials never leave the cluster and the attack surface is smaller.

Flux, Argo CD and Jenkins X

ToolWhat it isStands out for
Flux (FluxCD)A declarative, Kubernetes-native GitOps tool. It was born at Weaveworks and is a CNCF graduated projectLightweight and modular, focused on continuous delivery; managed entirely from Git
Argo CDA declarative GitOps tool, created at Intuit and graduated in the CNCF as part of the Argo projectIts web UI, which shows each application and its status; multiple repositories, clusters and namespaces
Jenkins XA platform that brings together several open source tools, from the CD FoundationCovers the whole CI/CD cycle, not just delivery; more complex than Flux and Argo CD

Flux and Argo CD follow the pull model and are installed as applications inside the cluster. This is how you bootstrap Flux, which stores even its own configuration in Git:

flux bootstrap github --owner=thor --repository=fleet --path=clusters/prod
flux get sources git
flux get kustomizations
flux reconcile kustomization apps --with-source
Updated. The first version of Flux could only watch one repository and deploy to one cluster and one namespace. Flux v2, the current one, works with multiple repositories, clusters and teams. And although Weaveworks shut down in 2024, Flux carries on as a CNCF project.

CI/CD with GitOps, step by step

GitOps usually uses two repositories: one with the application code and another with the Kubernetes manifests, which are the infrastructure as code. That way, the deployment history doesn't get mixed up with the code history, and permissions can be different.

shop-app/                    ← application repository (developers)
├── src/
├── Dockerfile
└── .github/workflows/ci.yml

shop-config/                 ← configuration repository (source of truth)
└── apps/shop/
    ├── deployment.yaml      image: ghcr.io/thor/shop:4f2c9a1
    ├── service.yaml
    └── ingress.yaml
A GitOps pipeline with two repositories A developer commits to the application repository. The CI pipeline tests the code, builds an image and pushes it to the registry, then updates the image tag in the configuration repository. Argo CD, inside the cluster, sees the new commit, pulls the manifests and applies them, and keeps reconciling the cluster with Git. APP REPO code · Dockerfile CI PIPELINE test · build · push REGISTRY shop:4f2c9a1 update image tag CONFIG REPO Kubernetes manifests source of truth pull (watch) CLUSTER ARGO CD sync · self-heal shop pods pulls image

CI builds the image and updates the config repository; Argo CD deploys from inside the cluster. Diagram: The House of Routing.

  1. A developer commits to the application repository.
  2. The CI pipeline tests the code, builds the image and pushes it to the registry.
  3. The pipeline updates the image tag in the config repository, usually through a pull request.
  4. Argo CD detects the new commit, reads the manifests and applies them to the cluster.
  5. From then on, Argo CD reconciles: if the cluster drifts from Git, it corrects it.

Argo CD in practice

Argo CD is installed in its own namespace:

kubectl create namespace argocd
kubectl apply -n argocd \
  -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml
kubectl get pods -n argocd

Each application is defined with an Application object: the repository URL, the path where the manifests live and the destination. With automated sync, selfHeal undoes any manual change in the cluster and prune deletes whatever is no longer in Git.

apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: shop
  namespace: argocd
spec:
  project: default
  source:
    repoURL: https://github.com/thor/shop-config.git
    targetRevision: main
    path: apps/shop              # where the Kubernetes manifests live
  destination:
    server: https://kubernetes.default.svc
    namespace: shop
  syncPolicy:
    automated:
      prune: true                # delete what was removed from Git
      selfHeal: true             # undo manual changes in the cluster
    syncOptions:
      - CreateNamespace=true

From the command line you can see the status of each application and, if a version fails, go back to an earlier one:

argocd app list                  # Synced / OutOfSync, Healthy / Degraded
argocd app get shop
argocd app sync shop             # sync now instead of waiting
argocd app history shop          # deployed revisions
argocd app rollback shop 3       # go back to revision 3
With selfHeal turned on, a rollback from Argo CD is temporary: Git is still the source of truth. The GitOps way to roll back is to revert the commit in the config repository.

Debugging applications

Delivery also means knowing what to do when something fails. The usual order: check the status, read the events, then the logs.

kubectl get pods                               # STATUS and RESTARTS
kubectl describe pod web-7d9f                  # Events: why it fails
kubectl logs web-7d9f                          # the container output
kubectl logs web-7d9f --previous               # the crash before the restart
kubectl get events --sort-by=.lastTimestamp    # what happened, in order
kubectl exec -it web-7d9f -- sh                # a shell inside the container
kubectl debug -it web-7d9f --image=busybox:1.36 --target=web   # a debug container
StatusWhat it meansWhere to look
PendingThe scheduler can't find a nodeThe events: resources, taints, PVCs (chapters 3 and 7)
ImagePullBackOffThe image can't be downloadedThe image name and tag, or the registry credentials
CrashLoopBackOffThe container starts and crashes over and overkubectl logs --previous
OOMKilledIt exceeded its memory limitThe container's limits (chapter 3)

Many production images don't include a shell. For those there's kubectl debug, which adds a temporary container with diagnostic tools to the pod.

KCNA-style challenge

Answer before you open the solution. Getting it wrong here is the cheapest way to learn.

1. In GitOps, what is the source of truth for the cluster's state?

The Git repository. Changes are made there, and an agent applies them to the cluster.

2. Which deployment model keeps the cluster's credentials inside it?

The pull model, with an agent such as Argo CD or Flux running inside the cluster.

3. Someone manually changes the replicas of a Deployment managed by Argo CD with selfHeal. What happens?

Argo CD reverts it to the value in Git: that's the continuous reconciliation principle.

4. Which of these is not one of the four principles of GitOps: declarative, versioned and immutable, deployed with push, continuously reconciled?

Deployed with push. The principle is the exact opposite: pulled automatically.

5. A pod is in CrashLoopBackOff. Which command shows you why it crashed?

kubectl logs with --previous, which shows the output of the container from before the last restart.

Key takeaways

  • CI integrates and tests every commit; CD gets it ready to deploy, or deploys it automatically.
  • GitOps: Git is the source of truth, and changes go to the repository, never straight to production.
  • The four principles: declarative, versioned and immutable, pulled automatically and continuously reconciled.
  • Push exposes the cluster's credentials outside it; pull keeps them inside.
  • Flux and Argo CD are CNCF graduated GitOps tools; Jenkins X covers the whole CI/CD cycle.
  • Two repositories are common: one for code and one for configuration.
  • To debug: kubectl get, describe, logs (including --previous), events, exec and debug.

You've reached the end of the course. You've worked through all four KCNA domains: Kubernetes fundamentals, container orchestration, cloud native architecture and application delivery. You now have the complete map; it's time to turn it into practice. Review each chapter's challenges, practice on a lab cluster and, when you feel ready, book your exam. Every step you take brings you closer to your point B.

Official resources

Source and credits. Chapter written from Jesús Espinoza's study notes on KodeKloud's KCNA course (January to April 2026). Text drafted with AI assistance; original diagrams by The House of Routing. Technical details and configuration examples were checked against the official Kubernetes, Argo CD, Flux, OpenGitOps and CNCF documentation.

Navigate