How to Integrate Argo CD and SQLite Safely

Published
Length
3 min read

Luis Felipe Dias

All posts

Teams pair argo cd and sqlite to deploy apps that use local database files. Argo CD syncs cluster manifests while SQLite stores app state on mounted volumes. This setup keeps deployments simple for small services, edge nodes, and internal tools. You avoid external database servers while keeping Git as your single source of truth. Yet local database files inside containers bring real security and data risks. Engineers need clear rules to manage file access and schema changes during syncs. How

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 pair argo cd and sqlite to deploy apps that use local database files. Argo CD syncs cluster manifests while SQLite stores app state on mounted volumes.

This setup keeps deployments simple for small services, edge nodes, and internal tools. You avoid external database servers while keeping Git as your single source of truth. Yet local database files inside containers bring real security and data risks. Engineers need clear rules to manage file access and schema changes during syncs.

How argo cd and sqlite work together in production

Argo CD reads state from Git and applies manifests to your Kubernetes cluster. Those manifests define the pods, persistent volumes, and jobs that run your app. SQLite runs inside the app pod as a library that reads one file. That file lives on a persistent volume so data survives pod restarts.

Permissions flow through two separate paths in this design. First, users and pipelines log in to Argo CD to trigger or view syncs. Second, the pod uses Linux file permissions to read and write the database. Schema updates often run as Kubernetes jobs during the Argo CD sync phase. These jobs mount the same volume and run SQL commands against the file.

Because SQLite is a file, any process with volume access can read everything. It does not have built-in user roles or network login checks. Your cluster settings and pod access controls must do all the security work.

Common risks with shared volumes and broad cluster roles

The biggest risk comes from broad pod exec permissions in Kubernetes. If engineers can open a shell into the pod, they control the database. Shared service accounts make this problem much worse across your team. Multiple users might use the same Argo CD role or cluster admin key. When someone changes a table or reads a row, you have no log. You cannot tell which person ran the query or why they did it.

Unlogged queries also create issues for sensitive user data. A support engineer might query a table to fix a broken sync. The result might return raw emails, phone numbers, or card numbers on screen. Without data masking, every manual check exposes private records to the user. Data masking rewrites matched fields in results so sensitive strings stay safe.

CI/CD Credential Management + End-to-End Encryption: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Volume lock conflicts cause another common failure during Argo CD syncs. If a migration job and an app pod write together, the file locks. Your sync fails and the app goes down until someone fixes the lock.

Scoping roles and network paths for local databases

Start by locking down who can trigger syncs and view pod logs. Give each team member a unique login in Argo CD mapped to groups. Limit Argo CD project roles so teams only touch their own namespaces. Turn off shell access to pods in production roles for normal users.

Use single-replica deployments with ReadWriteOnce volumes to prevent database lock errors. Run schema migrations as pre-sync hooks before the main app pod starts up. This ensures only one container writes to the SQLite file at a time.

For live database checks, stop using direct shell sessions into the running container. Route all human database queries through a controlled path that checks user identity. Log every SQL command with the user name and a clear timestamp. Apply masking rules to rewrite emails, phone numbers, and national IDs in results.

Add runtime guardrails and masking beside your databases and APIs

Login rules, role grants, and CI checks govern who connects to your stack. Yet any allowed script, engineer, or AI agent still runs commands with the full scope of its role. For workloads on Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes, SSH, or internal HTTP services, hoop.dev sits beside the service as an open-source proxy, a sidecar for your database or API.

Before a query runs, hoop.dev guardrails check the statement against your rules. An AI Analyzer you configure can score intent or hold risky calls for human review. Next, hoop.dev data masking rewrites sensitive fields in responses, and each verdict is logged per listener. Explore the MIT-licensed project on GitHub.

Frequently asked questions

Can multiple pods write to the same SQLite file during an Argo CD rollout?

No, multiple writers will cause file lock errors and risk data corruption. Use a recreate rollout strategy so the old pod stops before the new starts.

How should we run SQLite schema migrations with Argo CD?

Run migrations as an Argo CD pre-sync job or an init container. This ensures the schema update finishes before the main app opens the file.

How do we audit manual queries on a SQLite file in Kubernetes?

Disable direct pod shell access for engineers and disable raw file downloads. Require engineers to run queries through an audited tool that logs every command.

The query runs. The emails stay hidden.