Skip to main content

PocketBase on GKE Autopilot

PocketBase on GKE Autopilot

PocketBase is an open-source backend in a single file — an embedded SQLite database with a realtime REST API, built-in authentication, file storage, and an admin dashboard. This module deploys PocketBase on GKE Autopilot on top of the App_GKE foundation, which provisions and manages the shared Google Cloud and Kubernetes infrastructure.

This guide focuses on the cloud services PocketBase uses and how to explore and operate them from the Google Cloud Console and the command line. For the mechanics common to every GKE application — Workload Identity, ingress, autoscaling, CI/CD, Cloud Armor, IAP, Binary Authorization, VPC Service Controls, backups, and the deployment lifecycle — refer to the App_GKE foundation guide rather than repeating them here.


What PocketBase costs on RAD, and how that compares​

Running PocketBase in your own Google Cloud project costs about US$42.08/month in infrastructure, plus a one-time module fee of 75 RAD credits (sized at 1 vCPU / 1 GiB on GKE Autopilot pods). RAD charges the module fee once, at deploy time — never again on Update — plus build time metered in credits; Google Cloud usage itself is billed to your own billing account at Google's list price. On a RAD-managed project the same resources are metered hourly in credits at list price plus RAD's margin — about 67 credits/day — and the module fee is 10% lower, at 67.50 credits. See "Pause it for free" below for how a RAD-managed PocketBase deployment can be stopped, at no running cost, until you need it again. (or see the Cloud Run guide for the lower-cost option)

What you pay on RAD​

ItemOwn projectRAD-managed project
Module fee75 credits (once)67.50 credits (once)
Build time~3-6 credits, metered per build minutesame, metered in credits at list price + RAD's margin
Google Cloud running cost~$42.08/month, billed to your own billing account at Google's list price~67 credits/day, metered hourly at list price + RAD's margin

Default running cost in your own project

ResourceUS$/month (Google list price, us-central1)
GKE Autopilot pod, 1x vCPU / 1 GiB36.08
Cloud NAT and networking5
Cloud Storage (add-ons, backups)1
GKE cluster management fee*shared across every GKE app in the project; $0 if this is your only cluster, else ~73
Total$42.08

* Not included in the total above — it is shared across every GKE app running in the same project, so it is $0 if this is your only GKE cluster.

How it compares​

  • We could not verify a current, directly-comparable commercial SaaS price for this exact open-source project, so the honest comparison is a bare self-managed server: Hetzner CPX22 (2 vCPU/4GB, $24/mo), a DigitalOcean 2 vCPU/4GB Droplet ($24/mo), or a GCP Compute Engine e2-standard-2 (2 vCPU/8GB, ~$49/mo). This app's own footprint (1 vCPU or less, 1 GiB or less) is smaller than any of those classes, so a bare self-managed box sized to match would cost less than the figures above — but you would still own every patch, backup and security update yourself.
  • RAD is not claiming to beat a bare VPS on sticker price — it usually does not. What RAD adds for the same or a similar dollar figure is a managed database, Secret Manager-held credentials, monitoring, and one-click Update, none of which a bare VPS gives you for free.
  • On a bare VPS you are the one applying OS/database security patches, taking and testing backups, and renewing certificates; RAD's managed Cloud SQL, Secret Manager and monitoring handle all three for you.

Pause it for free: delete a RAD-managed project, restore it when you need it​

This is the headline option on a RAD-managed project, and it is free while paused. Deleting a RAD-managed project first unlinks its billing, then asks Google to delete the project itself — Google's own 30-day recoverable soft delete. Unlike deleting a single module, this does not tear down the database, any VM, or the compute resource one at a time: the whole project simply stops, and because billing is already unlinked, nothing is charged while it waits.

Restoring — within 30 days, and only by the project's owner — asks Google to undelete the project and reattaches its billing account, then asks you to run Update on each deployment to confirm everything came back. Because nothing was individually destroyed, that Update finds the same resources already there: it is a check, not a rebuild, and an Update never charges the module fee again. The whole restore costs only a handful of credits (under US$1) in build time for a typical chain of deployments. What this needs: you must own the project (not merely have RAD manage its billing), you must restore it yourself within the 30 days — after that Google deletes it for good — and restoring is admitted like creating a new project, so your purchased credit balance must still clear the tier's floor (100 credits for the sandbox tier most study and demo use fits). Google says most services are fully working again within 36 hours of a restore.

One real gap: nightly backups are written to a bucket inside the project, and that bucket has Cloud Storage's soft-delete explicitly turned off, so the backup bucket is very likely gone as soon as you delete the project — even though the project itself is recoverable for 30 days. If you have customised this deployment and want to keep that work, copy a backup out (to Google Drive, or a bucket outside the project) before deleting. For a default install with nothing irreplaceable in it, this does not matter.

Pay only while you use it, the other way: delete and redeploy​

The other lever, for an own project (or a RAD-managed one past its 30-day restore window), is to delete PocketBase outright and redeploy it later. A redeploy costs the module fee again plus the builds — roughly 78-81 credits in total for this module.

Deleting only saves money once PocketBase would otherwise sit unused long enough to clear that redeploy cost against its own running cost — for this module, that is about 6 days or more of being idle, based on its own US$42.08/month running cost above. Most of that running cost is usually the database and any shared file/cache VM, and they stop only once nothing else in the project uses them, so deleting this app alone saves only its own compute share if something else shares the project.

Keep data first: nightly backups go to a bucket inside the deployment and are deleted with it, so copy the latest backup out before deleting if you want to keep it.

Lab sessions and Managed Environments​

  • Lab sessions, for training: a trainer runs a session for a class. Each participant gets the app in their own Google Cloud project for 15 minutes to 24 hours, within an allowance the trainer sets. Either the trainer funds every place, or each participant pays for their own. Everything is deleted when the session ends and unused credits go back to the trainer.
  • Managed Environments, for consultancies: a partner runs the app for a client from a ring-fenced wallet it funds, and settles with the client directly. If the wallet runs low, billing pauses and the data is kept, so nobody receives an unexpected charge. At the end the partner hands the project over and the deployments become the client's own.
  • Credits can be bought in more than 20 currencies, including XAF, XOF, NGN, GHS, KES and ZAR, by card, bank transfer or mobile money.

Sources (8 October 2026): Google Cloud Billing Catalog API list prices; radmodules.dev/pricing for RAD's own fees and daily-credit estimates; Resource Manager: delete and restore projects for the pause/restore mechanics.

1. Overview​

PocketBase runs as a single self-contained Go binary. On GKE it is scheduled as a StatefulSet with a block Persistent Volume so its embedded SQLite database gets reliable POSIX file locking. The deployment wires together a deliberately minimal set of services:

CapabilityGoogle Cloud serviceNotes
ComputeGKE AutopilotSingle Go binary as a StatefulSet pod, 1 vCPU / 1 GiB by default, port 8090
DatabaseEmbedded SQLiteNo Cloud SQL — the database lives on a block PVC at /pb_data
Persistent storagePersistent Disk (block PVC)A per-pod ReadWriteOnce PVC (20 GiB default) mounted at /pb_data
Cache & queueNonePocketBase uses no Redis; enable_redis = false
SecretsSecret ManagerNone auto-generated — auth lives inside SQLite; secrets optional for your own use
IngressCloud Load BalancingLoadBalancer by default (external); PocketBase is a public-facing backend-as-a-service, not an internal-only workload

Sensible defaults worth knowing up front:

  • The database is embedded SQLite — there is no Cloud SQL. PocketBase stores every record, auth token, and uploaded file under /pb_data, which is a block PVC on GKE.
  • StatefulSet + block PVC by default. stateful_pvc_enabled = true — with no explicit workload_type this auto-resolves to StatefulSet. Block storage gives SQLite the reliable file locking it needs (SQLite over GCS FUSE is unreliable for locking, which is why GKE uses a PVC while Cloud Run uses FUSE).
  • The PVC mounts at /pb_data (20 GiB default). The Common layer sets enable_gcs_storage_volume = false when the PVC is enabled, so there is no double-mount at the same path.
  • Single replica. SQLite is single-writer and the PVC is ReadWriteOnce, so both min_instance_count and max_instance_count default to 1. Do not raise max_instance_count.
  • service_type = LoadBalancer by default (external access). PocketBase is a public-facing backend-as-a-service with an admin dashboard and REST API, so it is reachable from outside the cluster out of the box; set service_type = "ClusterIP" if you want it internal-only, or add a custom domain + managed certificate.
  • The admin account is created interactively on first run at /_/. No admin password is injected. Create the superuser immediately after the app is reachable.
  • No secret is auto-generated. PocketBase issues and stores all auth itself; Secret Manager is used only if you add your own secrets.
  • No Redis, no NFS. All state is the single /pb_data PVC.

2. Google Cloud Services & How to Explore Them​

All commands assume you have run gcloud container clusters get-credentials <cluster> --region <region> --project <project> and that PROJECT, REGION, and NAMESPACE are set. The namespace and other identifiers are reported in the deployment Outputs.

A. GKE Autopilot — the PocketBase workload​

PocketBase runs as a StatefulSet pod on Autopilot, which bills for the CPU/memory the pod requests. The StatefulSet gives the pod a stable identity and binds it to its /pb_data PVC across restarts.

  • Console: Kubernetes Engine → Workloads → select the PocketBase StatefulSet to see the pod, revisions, and events. Kubernetes Engine → Services & Ingress shows how it is exposed.
  • CLI:
    kubectl get statefulset,pods,svc -n "$NAMESPACE"
    kubectl logs -n "$NAMESPACE" statefulset/<service-name> --tail=100
    kubectl describe pod -n "$NAMESPACE" -l app=<service-name>

See App_GKE for how Autopilot, scaling, and the workload type (Deployment vs StatefulSet) are managed.

B. Database — embedded SQLite (no Cloud SQL)​

There is no Cloud SQL instance. PocketBase's database is a set of SQLite files on the block PVC at /pb_data. To inspect or back up the database you work with the PVC contents, not a SQL endpoint.

  • Console: Kubernetes Engine → Storage → Persistent Volume Claims → the PocketBase PVC.
  • CLI:
    # List the PVC bound to the PocketBase pod:
    kubectl get pvc -n "$NAMESPACE"
    # Inspect / copy the SQLite database out of the running pod for backup:
    kubectl exec -n "$NAMESPACE" statefulset/<service-name> -- ls -la /pb_data
    kubectl cp "$NAMESPACE"/<pod-name>:/pb_data/data.db ./pb_data-backup.db

C. Cloud Storage / Persistent storage — the /pb_data volume​

On GKE the /pb_data directory — the SQLite database, uploaded files, and settings — is a block PVC (ReadWriteOnce, 20 GiB default), not a GCS bucket. A Cloud Storage data bucket is still declared by the Common layer, but on GKE the PVC is authoritative and the FUSE mount is disabled to avoid a double-mount.

  • Console: Kubernetes Engine → Storage; Compute Engine → Disks (the backing PD).
  • CLI:
    kubectl get pvc,pv -n "$NAMESPACE"
    kubectl describe pvc -n "$NAMESPACE" <pvc-name> # size, StorageClass, bound PV

See App_GKE for StatefulSet PVC templates, StorageClasses, and CMEK options.

D. Secret Manager​

No secret is auto-generated for PocketBase — its auth is stored inside SQLite. Secret Manager is used only if you inject your own secrets (for example, SMTP credentials or external backup keys) via secret_environment_variables.

  • Console: Security → Secret Manager.
  • CLI:
    gcloud secrets list --project "$PROJECT" --filter="name~pocketbase"
    gcloud secrets versions access latest --secret=<secret-name> --project "$PROJECT"

See App_GKE for the Secret Store CSI integration.

E. Networking & ingress​

By default the workload is exposed via a LoadBalancer Service (external), reflecting PocketBase's role as a public-facing backend-as-a-service. To make it internal-only, set service_type = ClusterIP; a custom domain with a Google-managed certificate is also available, and a static IP can be reserved so the address survives redeploys.

  • Console: Network services → Load balancing; VPC network → IP addresses.
  • CLI:
    kubectl get ingress,svc -n "$NAMESPACE"
    gcloud compute addresses list --project "$PROJECT"

See App_GKE for custom domains, Cloud CDN, and static IP details.

F. Cloud Logging & Monitoring​

Pod stdout/stderr flow to Cloud Logging; GKE metrics flow to Cloud Monitoring. Optional uptime checks and alert policies are available.

  • Console: Logging → Logs Explorer; Monitoring → Dashboards / Alerting.
  • CLI:
    gcloud logging read 'resource.type="k8s_container" AND resource.labels.namespace_name="'"$NAMESPACE"'"' \
    --project "$PROJECT" --limit 50

3. PocketBase Application Behaviour​

  • No first-deploy database job. PocketBase creates its own SQLite database, system collections, and schema on first start under /pb_data. There is no db-init job to run or monitor.
  • Migrations apply automatically on start. PocketBase runs any pending schema migrations itself on every startup, so upgrading application_version applies schema changes with no separate migration step. Always back up the PVC before a version bump.
  • The admin superuser is created on first run. Once PocketBase is reachable, open /_/ and create the administrator account. Until it exists, anyone who reaches /_/ can claim it — treat this as a time-sensitive first-run step.
  • The /pb_data PVC is the only durable state. The SQLite database, uploaded files, and settings all live on the block PVC. It survives pod restarts and rescheduling; protect it and back it up on a schedule.
  • Single-replica StatefulSet. SQLite serialises writes through one file and the PVC is ReadWriteOnce. min_instance_count and max_instance_count both default to 1; do not raise max_instance_count.
  • Health path. Startup and liveness probes target /api/health, PocketBase's public, unauthenticated endpoint (returns HTTP 200 / {"code":200,"message":"API is healthy."}). First boot is fast because there is no external DB to wait on.
  • Verify runtime state:
    kubectl exec -n "$NAMESPACE" statefulset/<service-name> -- \
    wget -qO- http://127.0.0.1:8090/api/health
    kubectl exec -n "$NAMESPACE" statefulset/<service-name> -- env | sort

4. Configuration Variables​

Variables are grouped exactly as they appear on the deployment platform. Only settings specific to or notable for PocketBase are listed; every other input is inherited from App_GKE with its standard behaviour and defaults.

Group 1 — Project & Identity​

VariableDefaultDescription
project_id(required)Target Google Cloud project.
regionus-central1Region for the workload and regional resources.

Group 2 — Deployment Environment​

VariableDefaultDescription
tenant_iddemoShort suffix that makes resource names unique per environment.
support_users[]Emails granted project access and monitoring alerts.
resource_labels{}Labels applied to all resources.

Group 3 — Application Identity​

VariableDefaultDescription
application_namepocketbaseBase name for resources. Do not change after first deploy.
application_versionlatestImage tag; latest resolves to the pinned 0.22.21 build ARG. Pin an explicit release in production.

Group 4 — Runtime & Scaling​

VariableDefaultDescription
deploy_applicationtrueSet false to provision infrastructure only.
cpu_limit1000mCPU per pod; 1 vCPU is comfortable for the single Go binary.
memory_limit1GiMemory per pod; PocketBase is lightweight.
min_instance_count1Keep at 1 — GKE requires min ≥ 1 and SQLite is single-writer.
max_instance_count1Do not raise. SQLite + ReadWriteOnce PVC are single-writer; >1 corrupts data.
container_port8090PocketBase listens on 8090 (HTTP API + admin UI).
enable_cloudsql_volumefalseNo Cloud SQL Auth Proxy — PocketBase uses no external DB.
enable_image_mirroringtrueMirror/build the PocketBase image into Artifact Registry.

Group 6 — GKE Backend & Cluster​

VariableDefaultDescription
service_typeLoadBalancerExternal by default (PocketBase is public-facing); use ClusterIP for internal-only access.
workload_typenull → StatefulSetAuto-resolves to StatefulSet because stateful_pvc_enabled = true.
session_affinityNoneSingle replica, so stickiness is unnecessary.

Group 7 — StatefulSet​

VariableDefaultDescription
stateful_pvc_enabledtrueStrongly recommended — gives the SQLite DB durable block storage with reliable locking.
stateful_pvc_size20GiSize the PVC for the SQLite DB plus uploaded files and overhead.
stateful_pvc_mount_path/pb_dataMust be PocketBase's data directory — do not change.

Group 10 — Observability & Health​

VariableDefaultDescription
startup_probeHTTP /api/health, 15s delayStartup probe; fast because there is no external DB to wait on.
liveness_probeHTTP /api/health, 30s delayLiveness probe against the public health endpoint.
uptime_check_configdisabled, path /api/healthOptional Cloud Monitoring uptime check.

Group 13 — Filesystem (NFS)​

VariableDefaultDescription
enable_nfsfalseNFS is off — PocketBase persists everything to the /pb_data PVC.

Group 16 — Database Backend​

VariableDefaultDescription
db_name / db_user(empty)Inert — PocketBase uses an embedded SQLite database; no Cloud SQL role/database is created.

Group 19 — Custom Domain, Static IP & Networking​

VariableDefaultDescription
enable_custom_domaintrueProvision Ingress for custom hostnames + managed certificate (serves only when application_domains is set).
reserve_static_iptrueStable external IP across redeploys.

All other inputs follow standard App_GKE behaviour.


5. Outputs​

These values are returned on a successful deployment and are the quickest way to locate and explore the running resources.

OutputDescription
service_nameKubernetes Service name.
namespaceNamespace the workload runs in.
service_cluster_ipIn-cluster ClusterIP.
stage_service_cluster_ipsMap of ClusterIPs for stage-specific services.
service_external_ipExternal LoadBalancer IP (when a static IP is reserved).
service_urlURL to reach PocketBase.
storage_bucketsCreated Cloud Storage buckets.
network_name / network_exists / regionsVPC network, presence, available regions.
container_image / container_registryDeployed image and Artifact Registry repo.
monitoring_enabled / monitoring_notification_channelsMonitoring status and channels.
initialization_jobsNames of any custom setup jobs (none by default).
statefulset_nameName of the PocketBase StatefulSet.
deployment_id / tenant_id / resource_prefixNaming identifiers.
project_id / project_numberProject identifiers.
cicd_enabled / cicd_configurationCI/CD status and details (repo, trigger, registry).
github_repository_url / github_repository_owner / github_repository_nameCI/CD GitHub details.
artifact_registry_repository / cloudbuild_trigger_name / cloudbuild_trigger_idRegistry and build trigger.
kubernetes_readyWhether the cluster/workload is ready (false on the first apply of a new inline cluster).
vpc_sc_enabled / vpc_sc_perimeter_name / vpc_sc_dry_run_modeVPC-SC status.
audit_logging_enabled / artifact_registry_cmek_enabledAudit logging and CMEK status.

6. Configuration Pitfalls & Sensible Defaults​

Risk: Critical (data loss / outage / security) — High (service degraded) — Medium (cost or partial degradation) — Low (minor).

Inherited plan-time validation. This module passes its configuration through the App_GKE foundation engine, which validates values and combinations at plan time — a Deployment workload type alongside stateful_pvc_enabled = true, bare-integer ResourceQuota memory values, IAP with no authorized identities, out-of-range probe or retention values. Invalid configuration fails the plan with a clear, named error before any resource is created, so most mistakes below are caught up front rather than at apply or runtime.

SettingSensible valueRiskConsequence if wrong
max_instance_count1 (never raise)CriticalSQLite is single-writer and the PVC is ReadWriteOnce; a second replica cannot mount the volume and concurrent writers corrupt the database.
stateful_pvc_enabledtrueCriticalWithout a block PVC, SQLite falls back to GCS FUSE-style storage with unreliable locking → database corruption.
The /pb_data PVCNever delete; back upCriticalThe PVC is the database and file store — deleting it destroys all data.
stateful_pvc_mount_path/pb_data (fixed)CriticalMounting the PVC anywhere else leaves PocketBase writing its DB to ephemeral pod storage, lost on restart.
Admin account at /_/Create immediately after accessCriticalUntil the superuser exists, anyone reaching /_/ can claim it and own the instance.
application_version bumpBack up the PVC firstHighPocketBase auto-migrates the schema on start; an interrupted upgrade can leave the SQLite DB mid-migration.
workload_typeleave null (auto StatefulSet)HighForcing Deployment with stateful_pvc_enabled = true fails the plan-time validation.
service_typeLoadBalancer (external, the default) or ClusterIP (internal)HighSwitching to ClusterIP when external access is needed leaves the app unreachable from outside the cluster.
enable_iapOnly for private deploymentsHighIAP blocks all unauthenticated requests, including public API clients and the admin UI.
stateful_pvc_size20Gi (raise for heavy file uploads)MediumToo small a PVC fills up as uploaded files accumulate, and PVCs cannot always be shrunk.
memory_limit1GiLowPocketBase is lightweight; over-provisioning only adds cost on Autopilot.

For the foundation behaviour referenced throughout — IAM and Workload Identity, autoscaling, ingress and certificates, CI/CD, Cloud Armor, IAP, Binary Authorization, VPC-SC, backups, and image mirroring — see App_GKE. PocketBase-specific application configuration shared with the Cloud Run variant is described in PocketBase_Common.

Need RAD to do something it does not do yet? Request it on the roadmap, or vote on what is already there.