Production Example: Software Delivery Platform
Production setup with Polycrate CLI v0.71.0: HA bare-metal Kubernetes with hardening, Keepalived, Cilium, Longhorn, cert-manager, NGINX, and observability.
This example demonstrates a complete, production-ready deployment of a Software Delivery Platform on bare-metal servers using Polycrate CLI v0.71.0 — including clean separation between public configuration (workspace.poly) and age-encrypted secrets (secrets.poly.age, artifacts/secrets/kubeconfig.yml.age).
Architecture
- HA Kubernetes (k3s): 3 control-plane nodes + 6 worker nodes
- Floating IP: Keepalived for the Kubernetes API (
10.0.0.27:6443) - Host Hardening: SSH hardening,
auditd, log forwarding - Networking & Edge: Cilium CNI (with kube-proxy replacement, Gateway API, Hubble), NGINX Ingress Controller, cert-manager (Let's Encrypt)
- Storage: Longhorn (3x replicated)
- Observability: VictoriaMetrics + Grafana, VictoriaLogs
graph TB
subgraph "Control Plane (HA)"
CP1[CP 1: 10.0.0.11] --> VIP[Floating IP 10.0.0.27]
CP2[CP 2: 10.0.0.12] --> VIP
CP3[CP 3: 10.0.0.13] --> VIP
end
VIP --> K8s[Kubernetes API :6443]
K8s --> Cilium[Cilium CNI + Hubble]
K8s --> Longhorn[Longhorn Storage]
K8s --> Edge[NGINX Ingress + cert-manager]
K8s --> Obs[VictoriaMetrics + Grafana + VictoriaLogs]
1. Prerequisites and Workspace Initialization
Install the Polycrate CLI and initialize the production workspace:
curl -fsSL https://app.ayedo.cloud/api/v1/cli/public/install.sh | sh
export PATH="$HOME/.local/bin:$PATH"
mkdir -p "$HOME/.polycrate/workspaces/acme/acme-production-1"
cd "$HOME/.polycrate/workspaces/acme/acme-production-1"
polycrate workspace init --with-name acme-production-1 --with-organization acme
Generate a workspace encryption key and store it securely in your password manager:
polycrate tools pwgen -a age
export WORKSPACE_ENCRYPTION_KEY="AGE-SECRET-KEY-1EXAMPLE..."
2. Central Inventory (inventory.yml)
Create inventory.yml directly in the workspace root:
# inventory.yml
all:
vars:
ansible_user: deploy
ansible_ssh_port: 22
ansible_python_interpreter: /usr/bin/python3
ansible_become: true
hosts:
prod-cp-1: { ansible_host: 10.0.0.11 }
prod-cp-2: { ansible_host: 10.0.0.12 }
prod-cp-3: { ansible_host: 10.0.0.13 }
prod-worker-1: { ansible_host: 10.0.0.21 }
prod-worker-2: { ansible_host: 10.0.0.22 }
prod-worker-3: { ansible_host: 10.0.0.23 }
prod-worker-4: { ansible_host: 10.0.0.24 }
prod-worker-5: { ansible_host: 10.0.0.25 }
prod-worker-6: { ansible_host: 10.0.0.26 }
children:
k8s_controlplane:
hosts:
prod-cp-1: {}
prod-cp-2: {}
prod-cp-3: {}
k8s_worker:
hosts:
prod-worker-1: {}
prod-worker-2: {}
prod-worker-3: {}
prod-worker-4: {}
prod-worker-5: {}
prod-worker-6: {}
3. Public Configuration (workspace.poly)
Check current block versions beforehand using polycrate hub list --project ayedo --no-pager or polycrate hub inspect <block>. Specify all values as explicit literals (no YAML anchors, no kubeconfig.from, and no passwords):
# workspace.poly
name: acme-production-1
organization: acme
blocks:
- name: hardening
from: cargo.ayedo.cloud/ayedo/linux/hardening:<version>
config:
hosts: all
ssh:
port: 22
user: deploy
auditd:
enabled: true
- name: keepalived-controlplanes
from: cargo.ayedo.cloud/ayedo/linux/keepalived:<version>
config:
hosts: k8s_controlplane
app:
virtual_ips:
- 10.0.0.27/24
master: prod-cp-1
interface: eth0
- name: k8s
from: cargo.ayedo.cloud/ayedo/linux/k8s-1.27:<version>
config:
cluster_name: acme-production-1
kube_proxy:
disabled: true
flannel:
disabled: true
k3s:
tlssans:
- "10.0.0.27"
ansible_host_groups:
controlplane: k8s_controlplane
worker: k8s_worker
- name: cilium
from: cargo.ayedo.cloud/ayedo/k8s/cilium:<version>
config:
kube_proxy_replacement: true
gateway_api: true
k8s_service_host: 10.0.0.27
k8s_service_port: 6443
hubble:
enabled: true
- name: longhorn
from: cargo.ayedo.cloud/ayedo/k8s/longhorn:<version>
config:
volume_replica_count: 3
- name: cert-manager
from: cargo.ayedo.cloud/ayedo/k8s/cert-manager:<version>
config:
letsencrypt:
email: certs@acme.example
solver:
type:
- dns01
provider: cloudflare
create_secret: true
- name: ingress
from: cargo.ayedo.cloud/ayedo/k8s/nginx:<version>
config:
metrics:
enabled: true
- name: monitoring
from: cargo.ayedo.cloud/ayedo/k8s/victoria-metrics-stack:<version>
config:
grafana:
enabled: true
persistence:
enabled: true
storageclassname: longhorn
size: 30Gi
ingress:
enabled: true
host: grafana.acme.example
class: nginx
tls:
enabled: true
issuer: letsencrypt-production
- name: logs
from: cargo.ayedo.cloud/ayedo/k8s/victoria-logs:<version>
config:
namespace: victoria-logs
mode: single
workflows:
- name: deploy-platform-addons
prompt:
message: "Deploy platform add-ons to acme-production-1?"
steps:
- name: cilium
block: cilium
action: install
- name: longhorn
block: longhorn
action: install
- name: cert-manager
block: cert-manager
action: install
- name: ingress
block: ingress
action: install
- name: monitoring
block: monitoring
action: install
- name: logs
block: logs
action: install
4. Sensitive Values (secrets.poly → secrets.poly.age)
All passwords, tokens, and API keys are strictly separated into secrets.poly:
# secrets.poly (NEVER commit unencrypted!)
blocks:
- name: keepalived-controlplanes
config:
app:
password: "replace-with-generated-vrrp-secret"
- name: k8s
config:
k3s:
token: "replace-with-generated-k3s-token"
- name: cert-manager
config:
letsencrypt:
solver:
cloudflare:
api_token: "replace-with-cloudflare-token"
- name: monitoring
config:
grafana:
admin_password: "replace-with-generated-grafana-password"
5. Step-by-Step Rollout
Phase 1: Host Baseline and Kubernetes Cluster
# Pull blocks and validate configuration
polycrate validate workspace-poly ./workspace.poly
# 1. Harden nodes and configure the floating IP
polycrate run hardening install --blocks-auto-pull
polycrate run keepalived-controlplanes install --blocks-auto-pull
# 2. Provision the k3s cluster
polycrate run k8s install --blocks-auto-pull
Make sure the generated cluster kubeconfig is located at the standard path artifacts/secrets/kubeconfig.yml (if the k8s block wrote it to a block artifact directory, copy it once to artifacts/secrets/kubeconfig.yml).
Phase 2: Networking, Storage, Ingress, and Observability
From this point on, all Kubernetes blocks automatically use artifacts/secrets/kubeconfig.yml:
polycrate workflow run deploy-platform-addons --blocks-auto-pull
Phase 3: Encrypt Secrets and Commit
polycrate workspace encrypt
polycrate workspace status
polycrate git add --all
polycrate git commit -m "feat: initial production platform workspace"
6. Operations, Verification, and Debugging
# Direct SSH access to nodes via inventory.yml
polycrate ssh list
polycrate ssh prod-cp-1
polycrate ssh exec prod-cp-1 systemctl status k3s
# Cluster diagnostics via debug pod or local kubeconfig
export KUBECONFIG="$PWD/artifacts/secrets/kubeconfig.yml"
kubectl get nodes -o wide
kubectl get pods -A
polycrate k8s debug
# Targeted block upgrade (e.g., after testing in acme-staging-1)
polycrate hub inspect ayedo/k8s/cilium
polycrate block pull cargo.ayedo.cloud/ayedo/k8s/cilium:<new-version>
polycrate run cilium install
For cluster backups, add the cargo.ayedo.cloud/ayedo/k8s/velero:<version> block (check the latest version with polycrate hub inspect ayedo/k8s/velero) and configure an external S3 storage target.
See Also
- Workspace Encryption —
secrets.poly.ageandartifacts/secrets/ - On-Premises k3s Cluster — Details on bare-metal Kubernetes operations
- Software Delivery Platform — SDP architecture overview
- Troubleshooting — Help with common issues