The Simplest Way to Make Airflow and Fluxcd Work Like They Should

Published
Length
3 min read

Luis Felipe Dias

All posts

Teams use airflow and fluxcd together to run data jobs and sync cluster state from Git. FluxCD pulls task code from Git, and Airflow runs those tasks on a set schedule. This setup keeps your data pipelines and cluster apps in sync. When a developer pushes a code change, FluxCD updates the cluster right away. Then Airflow runs the next scheduled job using that fresh code. How airflow and fluxcd share keys and move data Each tool has a clear job in your cluster. FluxCD watches your Git repos a

Your coding agents run with your access.

Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.

Teams use airflow and fluxcd together to run data jobs and sync cluster state from Git. FluxCD pulls task code from Git, and Airflow runs those tasks on a set schedule.

This setup keeps your data pipelines and cluster apps in sync. When a developer pushes a code change, FluxCD updates the cluster right away. Then Airflow runs the next scheduled job using that fresh code.

How airflow and fluxcd share keys and move data

Each tool has a clear job in your cluster. FluxCD watches your Git repos and applies changes to your cluster. Airflow reads task files and starts worker pods to process data.

To work together, both tools need clear roles and keys. FluxCD needs read keys for your Git repo and write roles in the cluster. It uses these permissions to update Airflow deployment files and sync new task code.

Airflow needs its own cluster role to start and stop worker pods. When a job starts, the scheduler talks to the cluster API. It asks the cluster to launch a pod for that specific task.

Data flows in one clear direction during this process. Code moves from Git into the cluster through FluxCD. Task status and job logs flow from the worker pods back to Airflow.

Common failure modes and how to scope roles

Many teams make the mistake of sharing one service account between both tools. A shared account gives Airflow the same broad cluster rights that FluxCD needs. If a bad actor compromises a data job, they gain control over the whole cluster.

Broad tokens create another big risk for your team. Sometimes engineers give Airflow a cluster admin token just to make pod creation work. This shortcut lets any task read secrets from other namespaces.

End-to-End Encryption: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Unlogged actions also cause trouble during audits. When five engineers share one admin account to fix stuck jobs, logs show one name. You cannot tell who changed a job or deleted a pod.

You can fix these risks by scoping roles and network paths. Give FluxCD a role that only writes to the Airflow namespace. Give the Airflow scheduler a role that only manages worker pods in its own space.

Lock down your network paths with cluster network rules. Allow FluxCD to talk only to your Git host and the cluster API. Allow Airflow workers to reach only the specific databases they need for their jobs.

Keeping task code and cluster state in sync

Syncing task files requires a clean handoff between your Git repo and your workers. Some teams use FluxCD to update a shared volume or trigger a sync container. Other teams build task files right into new worker images.

Whichever path you pick, keep secret keys out of your Git repo. Store database keys in a secret store and mount them at runtime. Check that each worker pod only gets the keys for its own task.

When data jobs read PII like emails, phone numbers, or card numbers, protect the results. Data masking rewrites matched fields in results before workers write them to logs. This keeps sensitive values out of plain text job output.

Govern statements and responses across databases and APIs

Good config and scoped roles are needed setup. They do not check single queries in flight or mask sensitive fields in returned rows. Across Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, and internal HTTP endpoints, hoop.dev runs beside each supported service as an open-source proxy, a sidecar for your database or API.

First, hoop.dev guardrails block banned queries before they run. Then hoop.dev data masking rewrites matched sensitive values in responses in memory. The audit trail records every statement and verdict per resource. Furthermore, hoop.dev holds SOC 2 Type II and is open source on GitHub.

Frequently asked questions

Should FluxCD deploy Airflow task files directly?

FluxCD works best for managing the Airflow app and its cluster setup. For task files, have FluxCD update the image tag or config that pulls the code. This prevents large task repos from slowing down cluster sync loops.

How do we stop Airflow pods from reading FluxCD secrets?

Put FluxCD and Airflow in separate namespaces within your cluster. Give the Airflow service account a role that only works in the Airflow namespace. Cluster rules will block worker pods from reading secrets in the FluxCD space.

What happens to running Airflow jobs when FluxCD updates the cluster?

If you run tasks in separate worker pods, running jobs can finish their work. The Airflow scheduler will reconnect to those pods after FluxCD restarts it. Make sure your worker pods have enough time to finish before forced shutdowns.

The query runs. The emails stay hidden.