At a glance
| Folder | What it is |
|---|---|
base/ | The objects: Deployment, Service, PodDisruptionBudget, Ingress, deny backend, NetworkPolicy. Don't edit these. |
example/ | Your settings: namespace, image version, URL, hostname, ingress class, TLS. Copy it and edit the lines marked EDIT. |
kubectl apply -k uses Kustomize, which is built into kubectl 1.14 and later.
What this sets up
- The same as the Helm chart: 2 replicas as non-root UID 10001 with a read-only filesystem, no capabilities and
RuntimeDefaultseccomp. - An Ingress that sends
/metricsand/bootstrapto a tiny backend answering 404. - A PodDisruptionBudget.
- A NetworkPolicy that only lets your ingress controller reach port 8080.
Steps
Prepare the database
Run db-setup.sql ↗ once as your database admin, exactly as in the Helm guide.
Copy and edit the settings
git clone https://github.com/AncientiCe/palace-server-examples.git
cp -r palace-server-examples/kubernetes/manifests/example my-palace
# Edit every line marked EDIT in my-palace/kustomization.yaml.
# Keep base/ where it is, or change ../base to its path.Create the namespace and the secret
kubectl apply -f my-palace/namespace.yaml
kubectl -n palace create secret generic palace-server \
--from-literal=database-url="postgres://palace_app:$APP_PW@HOST:5432/palace?sslmode=require" \
--from-literal=license-key='your-license-key' \
--from-literal=jwt-secret="$(openssl rand -hex 32)" \
--from-literal=bootstrap-token="$(openssl rand -hex 24)"The secret stays out of your files on purpose. With GitOps, use Sealed Secrets, SOPS or External Secrets for it instead.
Apply
kubectl apply -k my-palace
kubectl -n palace rollout status deploy/palaceTo see exactly what will be created first: kubectl kustomize my-palace.
Create the first admin
Same command as the Helm guide, including removing the bootstrap token afterwards.
Change settings or upgrade
Edit my-palace/kustomization.yaml (for example newTag for a new Palace version, or a value under palace-config) and run kubectl apply -k my-palace again. A settings change creates a new ConfigMap, so the pods restart with it automatically.
Verified TLS to the database
To use sslmode=verify-full, add your database CA as a ConfigMap and mount it with a patch in my-palace/kustomization.yaml:
patches:
- target: {kind: Deployment, name: palace}
patch: |-
- op: add
path: /spec/template/spec/volumes
value: [{name: db-ca, configMap: {name: palace-db-ca}}]
- op: add
path: /spec/template/spec/containers/0/volumeMounts
value: [{name: db-ca, mountPath: /etc/palace/db-ca, readOnly: true}]Then end the database URL with ?sslmode=verify-full&sslrootcert=/etc/palace/db-ca/ca.crt.
Tested
Applied with kubectl apply -k on k3s (Kubernetes 1.31) with Traefik: both replicas ran as UID 10001, bootstrap, storing a memory and search worked through the Ingress, /metrics and /bootstrap returned 404 from outside, the NetworkPolicy blocked a pod in another namespace, and a settings change rolled the pods.
Nomad, Hetzner, OpenShift, another IaC tool? Request a setup ↗. Never paste license keys, passwords, tokens or database URLs in an issue.
Other setups
Docker Compose on one machine · DigitalOcean (Terraform) · AWS (Terraform, ECS Fargate + RDS) · Google Cloud (Terraform, Cloud Run + Cloud SQL) · Azure (Terraform, Container Apps + PostgreSQL Flexible Server) · Kubernetes (Helm) · Air-gapped (no internet) · Linux without Docker (systemd)