GitOps · · 2 min read

GitOps: Episode Three — Deploying Your First App with GitOps

Learn how to deploy your first application using GitOps with FluxCD. We’ll build manifests, commit to Git, and watch automation in action.

Deploying Your First App with GitOps
Photo by Mohammad Rahmani / Unsplash

With our Kubernetes cluster ready and FluxCD installed, it’s time to experience GitOps in action by deploying our first application.

In this post, we’ll walk through:

This is the true GitOps workflow — and it’s surprisingly satisfying once you see it work for the first time.

1. The Big Picture: How GitOps Deployment Works

Before jumping into YAML files, it’s helpful to visualize what we’re doing.

In GitOps, you don’t “deploy” manually. Instead:

Your cluster will always reflect what’s in Git. No manual kubectl apply needed.

Think of Git as your deployment dashboard — but without all the clicking.

2. Create Kubernetes Manifests for the App

Let’s create a simple application: a basic NGINX web server.

First, make a new folder inside your Git repository, under your cluster path:

mkdir -p clusters/my-cluster/apps/nginx

Inside this folder, create a file called deployment.yaml:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx
  namespace: default
spec:
  replicas: 2
  selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - name: nginx
        image: nginx:latest
        ports:
        - containerPort: 80

Next, create a service.yaml file to expose it:

apiVersion: v1
kind: Service
metadata:
  name: nginx
  namespace: default
spec:
  type: LoadBalancer
  selector:
    app: nginx
  ports:
  - port: 80
    targetPort: 80

These two files together describe what we want the cluster to run.

3. Define a Kustomization

Flux needs to know how to find and apply these manifests. We do that using a Kustomization resource.

Inside your cluster folder (clusters/my-cluster/), create a file called nginx-kustomization.yaml:

apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
  name: nginx
  namespace: flux-system
spec:
  interval: 5m0s
  path: ./clusters/my-cluster/apps/nginx
  prune: true
  sourceRef:
    kind: GitRepository
    name: flux-system

This tells Flux:

Later, we’ll register this Kustomization with Flux.

4. Commit and Push Your Changes

Once you’ve created the YAML files, it’s time to push everything to Git:

git add .
git commit -m "Add nginx app deployment and service"
git push origin main

This is the magic moment: Git becomes your deployment tool.

5. Let Flux Sync the Cluster

After pushing, Flux will detect the new Kustomization and start applying the manifests automatically.

You can check the sync status by running:

flux get kustomizations

If everything is working, you’ll soon see two nginx pods running:

kubectl get pods

And your service exposed:

kubectl get svc nginx

If your cluster is on a cloud provider (or configured to handle LoadBalancer services), you’ll get a public IP address where you can access the nginx welcome page.

Congratulations — you just deployed your first app with GitOps!

6. What’s Next

Now that we’ve deployed a simple application, we can start building more sophisticated workflows:

Each of these will build on the foundation we just laid down.

In the next post, we’ll dive deeper into multi-environment GitOps setups, where dev, staging, and production are managed separately but safely.


Previous Posts in the Series


Enjoying the journey?

Subscribe to get the next GitOps posts, hands-on tutorials, and real-world lessons straight to your inbox!

Read next