Table of Contents

Deployment Strategies

After a Docker image is built and pushed, it needs to be deployed. This page covers two approaches: direct kubectl apply and GitOps via Flux CD.

What this page covers

  • Direct deployment with kubectl apply or kubectl set image
  • GitOps deployment with Flux CD image automation
  • Choosing between the two approaches
  • Rolling updates and rollback

Direct deployment (simpler)

For the Docker-only track or simple K3s setups, CI can deploy directly:

# In your Gitea Actions workflow
- name: Deploy to K3s
  run: |
    kubectl set image deployment/my-app \
      my-app=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ gitea.sha }} \
      -n my-namespace

This requires the runner to have kubectl access to the cluster.

With Flux CD image automation, the deployment process is:

  1. CI pushes a new image tag to the registry.
  2. Flux's image reflector detects the new tag.
  3. Flux updates the image tag in the Git manifest.
  4. Flux applies the updated manifest to the cluster.

No CI pipeline needs direct cluster access. Git remains the source of truth.