Skip to main content

Zitadel on GKE Autopilot

Zitadel on GKE Autopilot

Zitadel is an open-source, cloud-native identity and access management (IAM) platform providing OpenID Connect, OAuth 2.0, SAML, and user/organization management. This module deploys Zitadel 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 Zitadel uses and how to explore and operate them from the Google Cloud Console and the command line. For the mechanics that are 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.


1. Overview

Zitadel runs as a single Go web workload. The deployment wires together a focused set of Google Cloud services:

CapabilityGoogle Cloud serviceNotes
ComputeGKE AutopilotGo pods, 2 vCPU / 4 GiB by default, horizontally autoscaled
DatabaseCloud SQL for PostgreSQL 15Required — Zitadel only supports PostgreSQL; MySQL is rejected at plan time
Object storageCloud StorageOne bucket provisioned automatically (operator use; core state lives in Postgres)
Cache & queueNoneZitadel stores all state in PostgreSQL — no Redis, no queue
SecretsSecret ManagerAuto-generated ZITADEL_MASTERKEY and initial admin password; database password
IngressCloud Load BalancingExternal LoadBalancer with ClientIP affinity; optional custom domain + managed cert

Sensible defaults worth knowing up front:

  • PostgreSQL is mandatory. database_type = POSTGRES_15 by default; a plan-time validation guard rejects MySQL and any non-Postgres engine. PostgreSQL 13/14 are also accepted.
  • ZITADEL_MASTERKEY is generated automatically and immutable. It is exactly 32 bytes and encrypts all sensitive data at rest. Never rotate it after first boot — doing so makes previously-encrypted data (client secrets, key material) unreadable.
  • Zitadel runs its own setup + migrations. The container starts with zitadel start-from-init, which creates the schema and applies migrations idempotently on first boot — there is no separate migrate job.
  • A first-instance admin is created on first boot. Organization ZITADEL and human admin zitadel-admin are seeded with a generated password from Secret Manager (PASSWORDCHANGEREQUIRED = false), so you can sign in immediately.
  • HTTP/2 with TLS terminated upstream. ZITADEL_EXTERNALSECURE = true, ZITADEL_EXTERNALPORT = 443, ZITADEL_TLS_ENABLED = false. Zitadel serves cleartext HTTP/2 on 8080 and trusts the GKE LoadBalancer to terminate TLS on :443. Set container_protocol = "h2c" if you need end-to-end HTTP/2 for gRPC API clients.
  • ZITADEL_EXTERNALDOMAIN must be set for external access. On GKE the entrypoint derives it from the injected service URL, which is the in-cluster address; behind an external IP or custom domain you must override ZITADEL_EXTERNALDOMAIN to the public host (see the Pitfalls table) or the OIDC issuer and Console redirects break.
  • Session affinity is ClientIP. Requests from the same client stick to the same pod — helpful for the Console UI session flow.
  • Minimum 1 replica is maintained (GKE does not support scale-to-zero) with max_instance_count = 5; a static external IP is reserved by default so the address survives redeploys.
  • NFS is enabled by default but unused by the app. Zitadel keeps all state in PostgreSQL; you can set enable_nfs = false unless another reason requires it.

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 Zitadel workload

Zitadel pods are scheduled on Autopilot, which bills for the CPU/memory the pods actually request. Horizontal Pod Autoscaling sizes the deployment between the minimum and maximum replica counts. A Cloud SQL Auth Proxy sidecar runs alongside the container.

  • Console: Kubernetes Engine → Workloads → select the Zitadel workload to see pods, revisions, and events. Kubernetes Engine → Services & Ingress shows the external IP.
  • CLI:
    kubectl get pods,svc,hpa -n "$NAMESPACE"
    kubectl logs -n "$NAMESPACE" deploy/<service-name> -c zitadel --tail=100
    kubectl logs -n "$NAMESPACE" deploy/<service-name> -c zitadel | grep cloud-entrypoint

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

B. Cloud SQL for PostgreSQL 15

Zitadel stores all application data (organizations, users, projects, applications, sessions, keys) in a managed Cloud SQL for PostgreSQL 15 instance. Pods reach it privately through the Cloud SQL Auth Proxy sidecar on 127.0.0.1; no public IP is exposed. On first deploy an initialization Job creates the application database and a role with CREATEDB/CREATEROLE; Zitadel then creates its own schema via start-from-init.

  • Console: SQL → select the instance for connections, backups, flags, and metrics.
  • CLI:
    gcloud sql instances list --project "$PROJECT" --filter="name~zitadel"
    gcloud sql instances describe <instance-name> --project "$PROJECT"
    gcloud sql connect <instance-name> --user=<db-user> --database=<db-name> --project "$PROJECT"

The instance name, database name, user, and the Secret Manager secret holding the password are all surfaced in the Outputs. For the connection model, automated backups, and password rotation, see App_GKE.

C. Cloud Storage

One Cloud Storage bucket is provisioned automatically (public access prevention enforced), and the workload service account is granted access. Zitadel keeps its core state in PostgreSQL, so the bucket is available for operator use. Additional buckets can be declared via storage_buckets.

  • Console: Cloud Storage → Buckets.
  • CLI:
    gcloud storage buckets list --project "$PROJECT"
    gcloud storage ls gs://<bucket>/ # bucket name is in the Outputs

See App_GKE for CMEK options and GCS Fuse mounts.

D. Secret Manager

Two secrets are generated automatically and stored in Secret Manager: ZITADEL_MASTERKEY (encrypts all data at rest) and the initial admin password (seeds the first-instance human on boot). They are delivered to the pod via the Secret Store CSI driver. The database password is managed separately by the foundation.

  • Console: Security → Secret Manager.
  • CLI:
    gcloud secrets list --project "$PROJECT" --filter="name~zitadel"
    # Read the initial admin password to log in the first time:
    gcloud secrets versions access latest \
    --secret="secret-<resource_prefix>-zitadel-admin-password" --project "$PROJECT"

See App_GKE for the Secret Store CSI integration and rotation, and Zitadel_Common for the criticality of the masterkey. Note the GKE SecretSync CRD rejects __ in synced keys — Zitadel's secret keys (ZITADEL_MASTERKEY, ZITADEL_FIRSTINSTANCE_ORG_HUMAN_PASSWORD) use single underscores and are unaffected.

E. Networking & ingress

By default the workload is exposed through an external Cloud Load Balancing IP with a reserved static address. A custom domain with a Google-managed certificate can be enabled. Because Zitadel serves gRPC + REST over HTTP/2, set container_protocol = "h2c" for end-to-end HTTP/2 when required.

  • 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 and Cloud SQL metrics flow to Cloud Monitoring. Optional uptime checks and alert policies are available. The [cloud-entrypoint] log lines show the resolved DB SSL mode and external domain.

  • 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. Zitadel Application Behaviour

  • First-deploy database setup. An initialization Job runs db-init.sh using postgres:15-alpine. It connects through the Cloud SQL Auth Proxy sidecar and idempotently creates the application database and a role with LOGIN CREATEDB CREATEROLE, grants privileges on the database and public schema, then signals the proxy to shut down so the Job pod completes. The job is safe to re-run and does not create Zitadel's schema — Zitadel does that itself.
  • Setup + migrations on start. The container runs zitadel start-from-init, which creates the schema and applies migrations idempotently on every start. Upgrading the application version applies schema changes without a separate migration step.
  • ZITADEL_MASTERKEY is immutable after first boot. It is generated once (exactly 32 bytes) and written to Secret Manager. Changing it makes all previously-encrypted data unreadable. Only touch it in a planned, understood migration.
  • First-run admin. Log in with username zitadel-admin (default) and the password from Secret Manager:
    gcloud secrets versions access latest \
    --secret="secret-<resource_prefix>-zitadel-admin-password" --project "$PROJECT"
    Then create a real admin, disable or restrict the seeded account, and configure your organizations, projects, and OIDC/SAML applications in the Console.
  • External domain must match the browser host. The OIDC issuer and Console redirect URIs are built from ZITADEL_EXTERNALDOMAIN. On GKE the entrypoint derives it from the injected (in-cluster) service URL, so for external access you must set ZITADEL_EXTERNALDOMAIN (via environment_variables) to the LoadBalancer IP's host or the custom domain — otherwise logins and token exchange fail. Patch a running deployment if the IP was assigned after deploy:
    kubectl set env deploy/<service-name> -n "$NAMESPACE" \
    ZITADEL_EXTERNALDOMAIN=zitadel.example.com
  • Health path. Startup, liveness, and readiness probes target /debug/healthz — an unauthenticated 200 endpoint. Allow ~7–8 minutes on first boot for setup + migrations.
  • Inspect the running configuration / jobs:
    kubectl exec -n "$NAMESPACE" deploy/<service-name> -c zitadel -- env | grep ZITADEL_
    gcloud run jobs executions list --job <job-name> --project "$PROJECT" --region "$REGION"

4. Configuration Variables

Variables are grouped exactly as they appear on the deployment platform. Only settings specific to or notable for Zitadel 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_deployment_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_namezitadelBase name for resources. Do not change after first deploy.
application_display_nameZitadelHuman-readable name shown in the Console.
application_versionlatestZitadel image tag; mapped to a pinned tag (v2.71.0) when latest. Pin explicitly in production.

Group 4 — Runtime & Scaling

VariableDefaultDescription
deploy_applicationtrueSet false to provision infrastructure only.
container_image_sourcecustomZitadel is a thin custom build FROM the ghcr image — leave as custom.
container_resources{ cpu_limit = "2000m", memory_limit = "4Gi" }Per-pod CPU/memory.
container_port8080Zitadel serves gRPC + REST over HTTP/2 on 8080.
container_protocolhttp1Set h2c for end-to-end HTTP/2 to gRPC API clients.
min_instance_count1Minimum replicas; GKE keeps ≥ 1 (no scale-to-zero).
max_instance_count5Maximum replicas; safe to raise — all state is in PostgreSQL.
enable_cloudsql_volumetrueCloud SQL Auth Proxy sidecar (keep true on GKE).
enable_image_mirroringtrueMirror the built image into Artifact Registry.
timeout_seconds300Maximum request duration.

Group 5 — Environment Variables & Secrets

VariableDefaultDescription
environment_variables{}Extra ZITADEL_* settings — set ZITADEL_EXTERNALDOMAIN here for external access. Core DB/TLS/masterkey values are set automatically.
secret_environment_variables{}Map of env var → Secret Manager secret name (avoid __ in keys).
secret_propagation_delay30Seconds to wait after secret creation before proceeding.
secret_rotation_period2592000sRotation notification frequency. Do not enable masterkey rotation.

Group 6 — GKE Backend & Cluster

VariableDefaultDescription
service_typeLoadBalancerExternal LoadBalancer for the Console and OIDC endpoints.
workload_typenull → DeploymentStateless Deployment; Zitadel keeps all state in PostgreSQL.
session_affinityClientIPSticky routing for the Console UI session flow.
namespace_name"" (auto-generated)Kubernetes namespace for the workload.
termination_grace_period_seconds60Seconds to wait after SIGTERM before SIGKILL.
enable_network_segmentationfalseCreate Kubernetes NetworkPolicy resources.

Group 7 — StatefulSet

VariableDefaultDescription
stateful_pvc_enablednull (off)Not needed — Zitadel stores all state in PostgreSQL, not on disk.

Group 9 — Reliability Policies

VariableDefaultDescription
enable_pod_disruption_budgettrueProtect availability during node upgrades.
pdb_min_available1Minimum pods available during voluntary disruptions.

Group 10 — Observability & Health

VariableDefaultDescription
startup_probeHTTP /debug/healthz, 60s delayStartup probe. Allow ~7–8 minutes on first boot.
liveness_probeHTTP /debug/healthz, 60s delayLiveness probe.
uptime_check_config(set)Optional Cloud Monitoring uptime check.
alert_policies[]Optional metric alert policies.

Group 11 — Jobs & Scheduled Tasks

VariableDefaultDescription
initialization_jobs[]Leave empty to use the built-in db-init job.
cron_jobs[]Not used — Zitadel has no platform-scheduled recurring tasks.
additional_services[]Sidecar or helper services (none required for Zitadel).

Group 13 — Filesystem (NFS)

VariableDefaultDescription
enable_nfstrueEnabled by default but unused — Zitadel keeps all state in PostgreSQL; safe to set false.
nfs_mount_path/opt/zitadel/storageMount path inside the container (unused).

Group 14 — Cloud Storage & Artifact Registry

VariableDefaultDescription
create_cloud_storagetrueCreate the declared GCS bucket(s).
storage_buckets[{ name_suffix = "data" }]One data bucket is declared by default; extend the list for additional buckets.
gcs_volumes[]GCS Fuse volume mounts via the CSI driver.
manage_storage_kms_iam / enable_artifact_registry_cmekfalseCMEK options.
max_images_to_retain / delete_untagged_images / image_retention_days(set)Artifact Registry cleanup policy.

Group 15 — Redis

Zitadel does not use Redis (all state is in PostgreSQL). enable_redis defaults to false and should be left off; the redis_* inputs are inert for this module.

Group 16 — Database Backend

VariableDefaultDescription
database_typePOSTGRES_15PostgreSQL only (13/14/15). MySQL is rejected at plan time.
application_database_namezitadelPostgreSQL database name. Immutable after first deploy.
application_database_userzitadelApplication database user (granted CREATEDB/CREATEROLE). Immutable after first deploy.
database_password_length32Generated password length.
enable_auto_password_rotation / rotation_propagation_delay_secoffZero-downtime DB password rotation.

Group 17 — Backup & Maintenance

VariableDefaultDescription
backup_schedule0 2 * * *Automated Cloud SQL backup cron (UTC).
backup_retention_days7Retention; raise to 30–90 for production/compliance.
enable_backup_import / backup_source / backup_uri / backup_formatrestore optionsRestore from a backup on deploy.

Group 19 — Custom Domain, Static IP & Networking

VariableDefaultDescription
enable_custom_domaintrueProvision Ingress for custom hostnames + managed certificate (a Gateway with a static IP is provisioned automatically). Remember to set ZITADEL_EXTERNALDOMAIN to match.
application_domains[]Hostnames to serve.
reserve_static_iptrueStable external IP across redeploys.

Group 20 — Identity-Aware Proxy (IAP)

Warning: Enabling IAP requires Google identity authentication for all inbound requests, including OIDC/machine clients and token endpoints. Only enable IAP for a fully private console.

VariableDefaultDescription
enable_iapfalseRequire Google sign-in in front of Zitadel.
iap_authorized_users / iap_authorized_groups[]Who may access.
iap_oauth_client_id / iap_oauth_client_secret""Required when IAP is enabled (sensitive).

Group 21 — Cloud Armor

VariableDefaultDescription
enable_cloud_armorfalseAttach a Cloud Armor (WAF) policy to the Ingress backend.
admin_ip_ranges[]CIDRs allowed privileged access.
enable_cdnfalseEnable Cloud CDN on the GKE Ingress backend.

Group 22 — VPC Service Controls & Audit Logging

VariableDefaultDescription
enable_vpc_scfalseEnforce a VPC-SC perimeter (requires organization_id).
vpc_cidr_ranges / vpc_sc_dry_run(set)Access level CIDRs / dry-run mode.
enable_audit_loggingfalseDetailed Cloud Audit Logs.

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 Zitadel.
database_instance_nameCloud SQL instance name.
database_nameApplication database name.
database_userApplication database user.
database_password_secretSecret Manager secret holding the DB password.
database_host / database_portDB endpoint (127.0.0.1 via the Auth Proxy) / port.
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_jobs / db_import_jobNames of the setup (db-init) and (optional) import jobs.
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.
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 non-Postgres database_type, enable_cloudsql_volume with database_type = NONE, IAP with no OAuth credentials, min_instance_count > max_instance_count, Redis enabled with no resolvable host, an out-of-range redis_port/backup_retention_days, and quota_memory_* without a binary unit suffix. 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
ZITADEL_MASTERKEY (auto-generated)Never rotate after first bootCriticalRotating it makes all previously-encrypted data (client secrets, key material) permanently unreadable.
database_typePOSTGRES_15CriticalZitadel only supports PostgreSQL; MySQL/other is rejected at plan time, and a wrong engine breaks startup.
application_database_name / application_database_userSet onceCriticalImmutable after first deploy; renaming recreates the DB/role and destroys all identity data.
enable_backup_importfalse unless restoringCriticalEnabling without a valid backup source fails the import job.
ZITADEL_EXTERNALDOMAINSet to the external hostCriticalOn GKE it defaults to the in-cluster URL; for external access you must set it to the LoadBalancer IP host or custom domain, or the OIDC issuer and Console redirects break and every login fails.
enable_cloudsql_volumetrueHighThe Auth Proxy sidecar is required for PostgreSQL connectivity; disabling it with a database configured is blocked by a plan-time guard.
min_instance_count1HighGKE requires min ≥ 1; the validation guard rejects invalid values. Keeping 1 keeps the IdP always reachable.
enable_iaponly for private consolesHighIAP blocks all unauthenticated requests, including OIDC/machine clients and token endpoints.
session_affinityClientIPHighWithout stickiness, Console UI sessions can bounce between pods mid-flow.
container_port8080HighZitadel listens on 8080; a mismatched port makes the workload never become Ready.
quota_memory_requests / _limitsbinary units (4Gi, 8192Mi)CriticalBare integers are bytes and block all pod scheduling in the namespace.
application_versionPin a releaseHighlatest maps to a pinned tag today, but pinning explicitly avoids surprise migrations on redeploy.
enable_nfsfalse (unused)LowEnabled by default but Zitadel stores no state on disk; leaving it on wastes an NFS mount.
enable_pod_disruption_budgettrueMediumDisabling allows GKE to evict all pods simultaneously during maintenance.
backup_retention_days7 (raise for prod)MediumToo short for compliance retention of identity data.

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. Zitadel-specific application configuration shared with the Cloud Run variant is described in Zitadel_Common.