Self-host PostHog on Kubernetes
posthog-k8s is a community Helm chart for PostHog: product analytics, web analytics, session replay, error tracking, logs, feature flags and surveys in your own Kubernetes cluster. Generated from PostHog's own compose file and tested end to end on every commit.
$ helm install posthog \
oci://ghcr.io/enricofranke/charts/posthog \
--namespace posthog --create-namespace \
--set posthog.siteUrl=https://posthog.example.com
STATUS: ALPHA (0.1.x) · RUNS IN OUR PRODUCTION · COMMUNITY PROJECT, NOT AFFILIATED WITH POSTHOG INC.
Why running PostHog on Kubernetes is hard
01PostHog stopped supporting Kubernetes in 2023 and archived its Helm chart in 2026. The only supported self-hosting path is a docker-compose file with about 35 containers on a single VM. That file is well maintained — but if you want PostHog next to your other workloads, with GitOps, your own Postgres and your own S3, there is no official way left.
Hand-written Kubernetes manifests drift from PostHog within weeks. So this chart hand-writes nothing: a generator reads the compose files at a pinned upstream commit and turns them into chart data; generic templates render the Kubernetes objects.
Upgrading PostHog becomes: bump the commit, read the diff, run CI. No reconciling dozens of manifests, no guessing which environment variable is new.
And because everything runs in your cluster, events, session replays and error reports stay in your own infrastructure — in your Postgres, your ClickHouse and the object storage you choose.
I built the chart because we wanted PostHog for our own products inside our own cluster. It has been running there since September 2026.
What the PostHog Helm chart gives you
02Two front doors
A Caddy router with an app listener (full UI and API, put it behind your SSO proxy) and an ingest listener that forwards only SDK paths and strips identity headers. Your login page never has to be on the internet.
Your datastores
External PostgreSQL — a CloudNativePG uri secret works out of the box — and S3-compatible object storage for replays and exports. Bundled PostgreSQL and SeaweedFS for evaluation.
Secrets by reference
Every secret can live in a Secret you own. When you let the chart generate them, they are created once and kept. Nothing secret in the pod spec.
Pinned and signed
Every image pinned by digest. Chart releases are pushed to GHCR and signed with cosign (keyless). appVersion is the upstream commit.
Secure defaults
Non-root everywhere, all capabilities dropped, no service-account tokens, optional NetworkPolicies, PodDisruptionBudgets and ClickHouse application users with real passwords.
Fast first start
A schema seed skips the 20-minute migration marathon a fresh PostHog database otherwise needs.
Tested for real
Generator unit tests, helm lint, helm unittest, kubeconform, Caddy config validation — and a full install on kind that signs up, sends an event, an exception and an OTLP log line, and evaluates a feature flag.
All of PostHog
Product analytics, web analytics, session replay, error tracking, logs, feature flags and surveys — every service from PostHog's compose setup, replaced only where Kubernetes has something better.
How the generator works
03PostHog/posthog @ pinned commit
- docker-compose.base.yml
- docker-compose.hobby.yml
- .env.services
- ClickHouse XML
sync_upstream.py
- + tools/rules.yaml
- unknown = hard error
Generated and versioned
- upstream.yaml
- files/upstream/
- upstream.lock
Generic templates
- + your values.yaml
Finished objects
- Deployments · StatefulSets
- Jobs · Services · Router
- NetworkPolicies · PDBs
- ServiceMonitors
Everything the generator does not understand is a hard error, not a guess: a new service, a new variable or a new hostname in the compose file fails the sync until tools/rules.yaml says what to do with it. upstream.lock records the commit and the checksum of every input.
Quick start: PostHog in 3 commands
04You need a cluster with a default StorageClass and about 18 GB of allocatable memory. Works on kind, k3s, k0s and Docker Desktop with enough RAM.
The first start takes 15 to 25 minutes, because a fresh database runs about 1,500 PostgreSQL and 300 ClickHouse migrations. Then open http://localhost:8080 and create the first user.
Small machine? The CI values fit a 16 GB box.
Every step on its own, from the cluster to the first event, is in the guide: self-host PostHog on Kubernetes step by step.
$ helm install posthog oci://ghcr.io/enricofranke/charts/posthog \ --namespace posthog --create-namespace \ --set posthog.siteUrl=http://localhost:8080 \ --set posthog.publicUrl=http://localhost:8081 \ --set posthog.secureCookies=false $ kubectl -n posthog get pods -w $ kubectl -n posthog port-forward svc/posthog-router 8080:8080 8081:8081
$ helm install posthog oci://ghcr.io/enricofranke/charts/posthog \
-n posthog --create-namespace \
-f https://raw.githubusercontent.com/enricofranke/posthog-k8s/main/charts/posthog/ci/kind-values.yaml
PostHog in production on Kubernetes
05This is how we run it: a three-node Kubernetes cluster managed by Argo CD. PostgreSQL comes from CloudNativePG with point-in-time recovery to S3, session replays live in an S3 bucket, and the UI is only reachable through an identity-aware proxy (Teleport).
Only the ingest listener for the SDKs is public. It answers 404 for anything that is not an SDK path. In front of the UI, Teleport, oauth2-proxy, Pomerium, Authelia or Cloudflare Access all work.
The full walkthrough with CloudNativePG, S3, local volumes, ingress and NetworkPolicies is in docs/production.md, the Argo CD example in docs/argocd.md. The short version with every command ready to copy is the production part of the guide.
posthog: siteUrl: https://posthog.example.com # UI, behind SSO proxy publicUrl: https://ph.example.com # where SDKs send events existingSecret: posthog-app postgresql: bundled: false external: host: posthog-pg-rw # CloudNativePG service username: app database: posthog existingSecret: posthog-pg-app urlKey: uri objectStorage: endpoint: https://s3.eu-central-1.amazonaws.com bucket: my-posthog region: eu-central-1 existingSecret: posthog-s3 bundled: {enabled: false} router: ingress: enabled: true className: nginx hosts: - {host: ph.example.com, listener: ingest} # public
Sizing
06| MEMORY | about 18 GB of requests with the default values |
|---|---|
| PODS | about 34 |
| VOLUMES | ClickHouse 100 GB, Redpanda 50 GB, PostgreSQL 20 GB, SeaweedFS 50 GB (only when bundled) |
| FIRST START | 15–25 minutes from scratch; with a schema seed the migrate job only has to confirm |
| MEASURED BY US | 3 projects, 2 M events and 6,500 recordings per month: about 20 GB RSS in total, ClickHouse and web being the largest |
Backups: PostgreSQL holds everything you cannot lose — users, dashboards, flags, issues — plus ENCRYPTION_SALT_KEYS from the env secret. Back up ClickHouse with BACKUP DATABASE and object storage with bucket versioning.
Upgrades: make sync UPSTREAM=<commit> regenerates upstream.yaml, you read the diff, CI installs it. Data migrations run in the migrate job on every install and upgrade. Back up first: helm rollback rolls pods back, not the schema.
What is not included (yet)
07- 01High availability for ClickHouse and Redpanda — one instance each on a PersistentVolume, same as the compose deployment. PostHog's replicated ClickHouse layout is a separate project.
- 02External ClickHouse or Kafka.
- 03PostHog's enterprise features: the
ee/code has its own license and the chart does not enable it. - 04In-place chart upgrades are not yet covered by CI, and values may change before 1.0.
- 05Automatic upstream bumps without a human reading the diff — and that is on purpose.
FAQ
08Does PostHog officially support Kubernetes?
No. PostHog stopped supporting its Helm chart in 2023 and archived it in 2026. The only officially supported self-hosting path is the docker-compose ("hobby") setup on a single VM. posthog-k8s is a community project and not affiliated with PostHog Inc.
How many resources does PostHog need on Kubernetes?
With the default values the chart requests about 18 GB of memory across roughly 34 pods. For a trial, the CI values fit a 16 GB machine.
Can I use my own PostgreSQL and S3?
Yes. External PostgreSQL is supported directly, including the CloudNativePG secret with its uri key. Session replays and exports go to any S3-compatible object storage. For evaluation the chart bundles PostgreSQL and SeaweedFS.
Does the chart work with Argo CD?
Yes. Helm hooks map to sync hooks. Set every secret explicitly or via existingSecret — Argo CD renders without lookup, so generated secrets would change on every sync — and use ServerSideApply=true. An example Application is in docs/argocd.md.
How long does the first install take?
A fresh database runs about 1,500 PostgreSQL and 300 ClickHouse migrations, which takes 15 to 25 minutes. With a schema seed — a pg_dump plus a ClickHouse backup of an already migrated, empty instance — the migrate job only has to confirm. In CI that brings a full run down from about 27 to about 10 minutes.
Is posthog-k8s production-ready?
It is alpha (0.1.x). The chart installs from scratch and passes the end-to-end test on every commit, and we run it in production ourselves. Values may still change before 1.0, and in-place chart upgrades are not yet covered by CI. There is no commercial support and no SLA.
Are PostHog's enterprise features included?
No. PostHog's ee/ directory has its own license and the chart does not enable it. It uses PostHog's public images unmodified.
Contribute
Issues and pull requests are welcome — in particular verified production setups, external ClickHouse and Kafka, the auth-proxy overlay and highly available ClickHouse. For anything else: [email protected].
posthog-k8s is a community project, not affiliated with or endorsed by PostHog Inc. "PostHog" is a trademark of PostHog Inc. The chart is Apache-2.0 licensed and uses PostHog's public images unmodified; PostHog itself is MIT-licensed except for the ee/ directory.