The Helm chart was failing before lunch. By dinner, it was running Pgcli on Kubernetes without a hiccup.
Deploying Pgcli with a Helm chart is fast once you know the exact steps. Pgcli is a modern Postgres CLI with auto-completion and syntax highlighting. Running it inside Kubernetes gives you direct, secure database access without installing anything on your local machine. Using Helm, you can package, configure, and ship it like any other application in your cluster.
Why Deploy Pgcli with Helm
Helm lets you define Pgcli’s configuration as code. You can store the chart in Git, review changes, and roll back when needed. This approach makes Pgcli accessible to any team member with cluster access, without leaking credentials or opening unnecessary ports. For production workloads, it keeps Pgcli confined to your Kubernetes network, close to your databases.
Creating the Pgcli Helm Chart
Start with a simple Helm chart layout:
pgcli/
Chart.yaml
values.yaml
templates/
deployment.yaml
service.yaml
Chart.yaml holds metadata.
values.yaml stores Postgres connection details (use secrets for credentials).
deployment.yaml defines the Pod running Pgcli, based on a lightweight Pgcli container image.
service.yaml optionally exposes the tool inside the cluster.
Configuration Steps
- Choose a Pgcli container image and tag.
- Add environment variables for
PGHOST, PGUSER, and PGDATABASE. - Mount Kubernetes secrets for passwords.
- Keep the service type as
ClusterIP to avoid exposing it to the public internet. - Package and install:
helm install pgcli ./pgcli
- Use
kubectl exec into the Pod to run Pgcli commands against your database.
Security Considerations
Always store credentials in Kubernetes Secrets, not plain text. Limit Pod permissions with RBAC. Use network policies to restrict database connections. Delete Pgcli Pods after use in sensitive environments to reduce exposure.
Scaling the Setup
For large teams, you can run Pgcli in several namespaces with different Helm values. CI/CD pipelines can deploy it on demand and remove it after database tasks complete. Templating in Helm makes it easy to swap environments—dev, staging, or production—without rewriting manifests.
You can have a working Pgcli Helm chart running in minutes. The right chart keeps your database access clean, automated, and repeatable. See it live, running in Kubernetes, in minutes—start now at hoop.dev.