Skip to main content

Kubernetes Deployment

Idenplane provides a Helm chart for production-grade Kubernetes deployments. This guide covers installation, configuration, and common operational tasks.


Prerequisites​

RequirementVersion
Kubernetes1.24+
Helm3.12+
kubectl1.24+

Quick Start​

The fastest way to deploy Idenplane on Kubernetes:

# The chart is not published to a Helm repository; install it from a checkout
git clone https://github.com/idenplane/idenplane.git && cd idenplane

# Create namespace
kubectl create namespace idenplane

# Install with production values
helm upgrade --install idenplane ./helm/idenplane \
--namespace idenplane \
--values ./helm/idenplane/values.production.yaml \
--set env.BASE_URL="https://auth.example.com"

# Read the generated admin password
kubectl get secret --namespace idenplane idenplane-keys \
-o jsonpath="{.data.ADMIN_PASSWORD}" | base64 -d; echo

The chart generates the admin password, the admin API key, the webhook encryption keys and the bundled database password on the first install, and keeps them on upgrades. See Secrets.


Installing from Local Chart​

1. Prepare Values File​

Create a production-values.yaml file:

# replica count
replicaCount: 3

# image
image:
repository: islamawad/idenplane
tag: "latest"
pullPolicy: IfNotPresent

# ingress
ingress:
enabled: true
className: nginx
annotations:
cert-manager.io/cluster-issuer: letsencrypt-prod
nginx.ingress.kubernetes.io/proxy-body-size: "10m"
hosts:
- host: auth.example.com
paths:
- path: /
pathType: Prefix
tls:
- secretName: idenplane-tls
hosts:
- auth.example.com

# environment
env:
NODE_ENV: "production"
BASE_URL: "https://auth.example.com"
SESSION_STORE: "database"
THROTTLE_TTL: "60000"
THROTTLE_LIMIT: "100"

# secrets — leave empty to generate on first install (see Secrets below)
secrets:
existingSecret: "" # required with Argo CD / Flux / helm template
DATABASE_URL: "" # required when postgresql.enabled is false

# bundled PostgreSQL (official image); prefer a managed database in production
postgresql:
enabled: true
auth:
username: idenplane
password: "" # generated when empty
database: idenplane
primary:
persistence:
enabled: true
size: 20Gi

# horizontal pod autoscaler
autoscaling:
enabled: true
minReplicas: 2
maxReplicas: 10
targetCPUUtilizationPercentage: 70

# pod disruption budget
podDisruptionBudget:
enabled: true
maxUnavailable: 1

# high availability — spread pods across nodes
affinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 100
podAffinityTerm:
labelSelector:
matchLabels:
app.kubernetes.io/name: idenplane
topologyKey: kubernetes.io/hostname

2. Secrets​

The chart keeps the application keys in the <fullname>-keys Secret (idenplane-keys for a release named idenplane): ADMIN_API_KEY, ADMIN_PASSWORD (the initial admin user), WEBHOOK_SECRET_KEY and WEBHOOK_ENCRYPTION_SALT. A value you set under secrets: is used as is. An empty one is generated on the first install and read back from the cluster on every upgrade, so it never changes. The Secret has helm.sh/resource-policy: keep, so helm uninstall leaves it in place.

Back the Secret up. The two webhook values encrypt stored webhook secrets, and losing them makes those secrets unreadable.

GitOps

Argo CD, Flux and helm template cannot read the stored Secret back, so they would generate new keys on every render. Create the four keys yourself and point the chart at them:

kubectl create secret generic idenplane-app-keys --namespace idenplane \
--from-literal=ADMIN_API_KEY="$(openssl rand -hex 32)" \
--from-literal=ADMIN_PASSWORD="$(openssl rand -hex 16)" \
--from-literal=WEBHOOK_SECRET_KEY="$(openssl rand -hex 32)" \
--from-literal=WEBHOOK_ENCRYPTION_SALT="$(openssl rand -hex 16)"

Then set secrets.existingSecret: idenplane-app-keys, and likewise postgresql.auth.existingSecret (key password) for the bundled database.

To rotate the encryption key, set the new values as secrets.WEBHOOK_SECRET_KEY / secrets.WEBHOOK_ENCRYPTION_SALT and the old ones as secrets.WEBHOOK_SECRET_KEY_PREVIOUS / secrets.WEBHOOK_ENCRYPTION_SALT_PREVIOUS (with secrets.existingSecret, add those two keys to your Secret instead). The chart never generates the previous key. Once the log reports Key rotation complete, remove the previous values and upgrade again. Keep the new ones set explicitly, or leave them empty: the Secret now holds the new values, and the chart keeps them.

Rendering fails on the old placeholders (change-me-in-production, REPLACE_WITH_STRONG_SECRET, REPLACE_WITH_STRONG_DB_PASSWORD), on an admin API key shorter than 32 characters and on an admin password shorter than 12.

3. Install the Chart​

helm upgrade --install idenplane ./helm/idenplane \
--namespace idenplane \
--create-namespace \
--values ./helm/idenplane/values.production.yaml \
--set env.BASE_URL="https://auth.example.com"

Configuration Reference​

Image Settings​

ParameterDescriptionDefault
image.repositoryContainer image repositoryislamawad/idenplane
image.tagImage tag (defaults to chart appVersion)""
image.pullPolicyImage pull policyIfNotPresent
imagePullSecretsSecrets for private registries[]

Service Configuration​

ParameterDescriptionDefault
service.typeKubernetes Service typeClusterIP
service.portService port3000
service.targetPortContainer portSame as service.port

Ingress Configuration​

ParameterDescriptionDefault
ingress.enabledEnable Ingressfalse
ingress.classNameIngress class (nginx, traefik)""
ingress.annotationsCustom annotations{}
ingress.hostsHost configurationsSee values.yaml
ingress.tlsTLS configurations[]

Example ingress annotations for cert-manager:

ingress:
annotations:
cert-manager.io/cluster-issuer: letsencrypt-prod
kubernetes.io/ingress.class: nginx

Resource Limits​

ParameterRequestLimit
CPU100m500m
Memory128Mi512Mi

For production, increase resources:

resources:
requests:
cpu: 250m
memory: 256Mi
limits:
cpu: 500m
memory: 512Mi

Probe Configuration​

ProbePathInitial DelayPeriod
Startup/health10s10s
Liveness/health15s20s
Readiness/health/ready10s10s

Unattended bootstrap​

bootstrap.enabled: true sets up a fresh release from values alone. At the first start, the realms under bootstrap.realms are created and the setup wizard is closed, so no one has to open it. This is how a GitOps install (Argo CD, Flux) comes up ready. Unattended Bootstrap describes the mechanism, the document format and what happens when it fails. The chart only renders the document and points BOOTSTRAP_FILE at it.

ValueDefaultMeaning
bootstrap.enabledfalseMount the bootstrap document and set BOOTSTRAP_FILE.
bootstrap.realms[]Realm export documents (version 2) to create. Rendered with version: 1 into the Secret <fullname>-bootstrap. Empty: only the wizard is closed.
bootstrap.existingSecret""A Secret you manage that holds the whole document. realms is then ignored and the chart creates no Secret.
bootstrap.existingSecretKeybootstrap.jsonThe document's key in existingSecret.
bootstrap.mountPath/etc/idenplane/bootstrapWhere the document is mounted, read-only.

Keep secrets out of the values. Reference them as ${env:NAME} and add NAME to secrets.existingSecret; every key in that Secret reaches the pods as an environment variable. With Flux post-build substitution on the Kustomization that holds the HelmRelease, write $${env:NAME}.

secrets:
existingSecret: idenplane-app-keys # ADMIN_API_KEY, ADMIN_PASSWORD, WEBHOOK_*, ACME_WEB_CLIENT_SECRET
bootstrap:
enabled: true
realms:
- version: 2
realm:
name: acme
displayName: Acme
clients:
- clientId: acme-web
clientSecret: ${env:ACME_WEB_CLIENT_SECRET}
redirectUris: [https://app.example.com/callback]
grantTypes: [authorization_code, refresh_token]
kubectl create secret generic idenplane-app-keys --namespace idenplane \
--from-literal=ADMIN_API_KEY="$(openssl rand -hex 32)" \
--from-literal=ADMIN_PASSWORD="$(openssl rand -hex 16)" \
--from-literal=WEBHOOK_SECRET_KEY="$(openssl rand -hex 32)" \
--from-literal=WEBHOOK_ENCRYPTION_SALT="$(openssl rand -hex 16)" \
--from-literal=ACME_WEB_CLIENT_SECRET="$(openssl rand -hex 32)"
  • Several replicas. They may all start at once. They serialize on the setup wizard's lock, and exactly one applies the document.
  • Probes. While bootstrap runs, a pod does not answer its probes.
  • Failure. The container exits before it is ready and nothing is written. The pod restarts (CrashLoopBackOff) until the values or the Secret are fixed, and helm install --wait fails.
  • Upgrades. The document is applied once. Changing bootstrap.realms after the first install has no effect: manage the realms with the admin API or the Terraform provider.
  • helm test checks that the setup wizard reports completed.

Database Configuration​

Bundled PostgreSQL (Default)​

The chart runs one PostgreSQL pod on the official postgres image, which suits evaluation and small installs. Its password is generated unless you set postgresql.auth.password or postgresql.auth.existingSecret. For production, prefer a managed database (below).

postgresql:
enabled: true
image:
tag: "17-bookworm"
primary:
persistence:
enabled: true
size: 20Gi

Upgrading from chart 0.2.x (Bitnami sub-chart)​

Chart 0.2.x pulled PostgreSQL and Redis from Bitnami sub-charts. Their docker.io/bitnami images are no longer published, so those pods cannot be rescheduled. Chart 0.3.0 replaces them with the official images and reuses the existing volume: same claim name (data-<release>-postgresql-0), same data directory, the same user ID (1001) and the same PostgreSQL major version (17, Debian).

A StatefulSet's selector cannot change, so delete the old StatefulSets without deleting their volumes, then upgrade:

kubectl delete statefulset idenplane-postgresql --namespace idenplane --cascade=orphan
kubectl delete statefulset idenplane-redis-master --namespace idenplane --cascade=orphan # only if redis.enabled
helm upgrade idenplane ./helm/idenplane --namespace idenplane --reuse-values

Take a pg_dump first. The database password stays the same: the chart reads it from the existing <release>-postgresql Secret.

External PostgreSQL​

To use an external database:

postgresql:
enabled: false

secrets:
DATABASE_URL: "postgresql://user:pass@host:5432/idenplane"

Redis (Optional)​

Enable Redis for session caching and improved performance:

redis:
enabled: true
auth:
enabled: true
password: "" # generated when empty

env:
SESSION_STORE: "redis" # REDIS_URL is wired to the bundled Redis

High Availability​

Update strategy​

The chart replaces pods with strategy.type: Recreate by default: every old pod stops before the new ones start, so there is a short outage during helm upgrade. Upgrading to 0.8.0 needs it, because 0.8.0 encrypts stored secrets, including the token signing key, and older versions cannot read them. Old and new pods must not run side by side.

values.production.yaml uses rolling updates instead: pods are replaced one at a time, each new one ready before an old one stops, so helm upgrade has no outage. Old and new versions run side by side for a moment, which is fine for upgrades between versions that don't need Recreate. When upgrading from a release before 0.8.0, or to a release whose notes say it needs Recreate, add --set strategy.type=Recreate; the chart drops rollingUpdate for it.

A stopping pod waits preStopSleepSeconds (10 by default) before Idenplane is signalled, so the Service and the ingress stop sending it requests first; terminationGracePeriodSeconds (40) covers that wait and the app's own shutdown.

To use rolling updates with the default values:

strategy:
type: RollingUpdate
rollingUpdate:
maxUnavailable: 0
maxSurge: 1

Each release's Before you upgrade notes in the CHANGELOG say whether that release needs Recreate again.

Horizontal Pod Autoscaler​

Enable HPA for automatic scaling:

autoscaling:
enabled: true
minReplicas: 2
maxReplicas: 10
targetCPUUtilizationPercentage: 70

Pod Disruption Budget​

Ensure availability during node maintenance:

podDisruptionBudget:
enabled: true
maxUnavailable: 1

Pod Anti-Affinity​

Spread pods across nodes:

affinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 100
podAffinityTerm:
labelSelector:
matchLabels:
app.kubernetes.io/name: idenplane
topologyKey: kubernetes.io/hostname

Security Configuration​

Pod Security Context​

podSecurityContext:
fsGroup: 1000
runAsNonRoot: true
runAsUser: 1000

Container Security Context​

securityContext:
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
readOnlyRootFilesystem: false
runAsNonRoot: true
runAsUser: 1000

Network Policies​

The chart can render a NetworkPolicy for the Idenplane pods. It is off by default; turn it on with networkPolicy.enabled: true. Your cluster's CNI plugin must enforce NetworkPolicy (Calico, Cilium and most managed offerings do); without one the object is accepted and has no effect.

When enabled, the policy:

  • Ingress: allows only the application port (the container port named http, set by env.PORT), from the sources in networkPolicy.ingress.from. With an empty list any source may reach that port, and every other port is closed. Pods of the same release (the helm test pod) are always allowed.
  • Egress: allows DNS (UDP and TCP 53), PostgreSQL, the bundled Redis when redis.enabled is true, and the rules in networkPolicy.egress.extraRules. Everything else is denied. Set networkPolicy.egress.enabled: false to restrict only ingress.

PostgreSQL is handled for you: with the bundled database the policy selects its pod. With an external database (postgresql.enabled: false), traffic to networkPolicy.egress.postgresql.port (5432) is allowed to the peers in networkPolicy.egress.postgresql.to, or to any destination if that list is empty.

networkPolicy:
enabled: true
ingress:
# Only the ingress controller may reach Idenplane
from:
- namespaceSelector:
matchLabels:
kubernetes.io/metadata.name: ingress-nginx
egress:
dns:
to:
- namespaceSelector:
matchLabels:
kubernetes.io/metadata.name: kube-system
# External database (postgresql.enabled: false)
postgresql:
port: 5432
to:
- ipBlock:
cidr: 10.20.0.15/32
extraRules:
# HTTPS to external identity providers, webhook targets, CAPTCHA and SMS
# providers
- ports:
- protocol: TCP
port: 443
to:
- ipBlock:
cidr: 0.0.0.0/0
except: [10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16]
# SMTP submission
- ports:
- protocol: TCP
port: 587

Add an egress rule for everything else the server calls: SMTP, external identity providers (their token, userinfo and JWKS endpoints), webhook targets, CAPTCHA and SMS providers, and an external Redis. If your cluster runs DNS somewhere other than kube-system (NodeLocal DNSCache, OpenShift's openshift-dns), change networkPolicy.egress.dns.to, or set it to [] to allow port 53 to any destination. The policy covers only the Idenplane pods, not the bundled PostgreSQL and Redis.


Managing Deployments​

Upgrading​

# Upgrade to new version
helm upgrade idenplane ./helm/idenplane \
--namespace idenplane \
--values ./helm/idenplane/values.production.yaml

# Upgrade with new values
helm upgrade idenplane ./helm/idenplane \
--namespace idenplane \
--set image.tag="0.10.1"

Rolling Back​

# List release history
helm history idenplane --namespace idenplane

# Roll back to previous revision
helm rollback idenplane --namespace idenplane

# Roll back to specific revision
helm rollback idenplane --revision 3 --namespace idenplane

Uninstalling​

# Remove the release (preserves data with PVCs)
helm uninstall idenplane --namespace idenplane

# Remove with data (deletes the database!)
helm uninstall idenplane --namespace idenplane
kubectl delete pvc -n idenplane -l app.kubernetes.io/instance=idenplane
# The chart's Secrets have helm.sh/resource-policy: keep; delete them by hand
kubectl delete secret -n idenplane -l app.kubernetes.io/instance=idenplane

Monitoring​

Health Endpoints​

EndpointDescription
/healthLiveness check
/health/readyReadiness check

/health/ready answers 503 when the database is unreachable, when Redis is configured and does not answer, or when the used heap is above 90% of the heap limit of the process. The limit is the one Node.js derives from the container's memory limit, or the one set with NODE_OPTIONS=--max-old-space-size.

Viewing Logs​

# Follow pod logs
kubectl logs -n idenplane -l app.kubernetes.io/name=idenplane -f

# View previous container logs
kubectl logs -n idenplane -l app.kubernetes.io/name=idenplane --previous

Checking Status​

# Helm release status
helm status idenplane --namespace idenplane

# Pod status
kubectl get pods -n idenplane

# Service status
kubectl get svc -n idenplane

# Ingress status
kubectl get ingress -n idenplane

Common Commands​

# Describe deployment
kubectl describe deployment idenplane -n idenplane

# Describe pod
kubectl describe pod -n idenplane -l app.kubernetes.io/name=idenplane

# Execute shell in pod
kubectl exec -it -n idenplane deploy/idenplane -- sh

# Port forward for local access
kubectl port-forward -n idenplane svc/idenplane 3000:3000

Troubleshooting​

Pod Not Starting​

  1. Check pod status:

    kubectl get pods -n idenplane
    kubectl describe pod -n idenplane <pod-name>
  2. Check container logs:

    kubectl logs -n idenplane <pod-name>
  3. Verify secrets exist:

    kubectl get secret -n idenplane

ImagePullBackOff​

  1. Verify image exists:

    kubectl describe pod -n idenplane <pod-name>
  2. Check image pull secret if using private registry:

    kubectl create secret docker-registry regcred \
    --docker-server=https://index.docker.io/v1/ \
    --docker-username=<user> \
    --docker-password=<token> \
    --docker-email=<email> \
    --namespace idenplane

Database Connection Issues​

  1. Verify PostgreSQL is running:

    kubectl get pods -n idenplane -l app.kubernetes.io/component=postgresql
  2. Check connection string:

    kubectl exec -it -n idenplane deploy/idenplane -- sh -c 'echo $DATABASE_URL'
  3. Test connectivity:

    kubectl exec -it -n idenplane deploy/idenplane -- nc -zv idenplane-postgresql 5432

Next Steps​

Environment Variables Complete list of all configuration options

Configuration Detailed configuration guide

Docker Compose Deploy using Docker Compose


idenplane.com · GitHub · Discord