Deploy guide

Palace Server on Kubernetes with plain kubectl

The same setup as the Helm chart, as plain YAML files you apply with kubectl apply -k. No Helm, no templates: every object that ends up in your cluster is in these files. Flux or Argo CD can also point at your copy of the folder if you use GitOps later.

At a glance

FolderWhat 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 RuntimeDefault seccomp.
  • An Ingress that sends /metrics and /bootstrap to a tiny backend answering 404.
  • A PodDisruptionBudget.
  • A NetworkPolicy that only lets your ingress controller reach port 8080.

Steps

01

Prepare the database

Run db-setup.sql ↗ once as your database admin, exactly as in the Helm guide.

02

Copy and edit the settings

Copy the example 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.
03

Create the namespace and the secret

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.

04

Apply

Apply
kubectl apply -k my-palace
kubectl -n palace rollout status deploy/palace

To see exactly what will be created first: kubectl kustomize my-palace.

05

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:

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.

View on GitHub ↗

Running something different?

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)

Put your knowledge to work

Give your next session
a head start.

Start your team trial

60 days · 10 seats · No credit card