Run your nSelf stack on Kubernetes. Convert an existing Docker Compose project, generate Helm charts, deploy to any cluster, and manage namespaces and rollbacks — all from one command.
# Convert an existing nSelf project to Kubernetes manifests
nself k8s convert
# Initialize Kubernetes support in the current project
nself k8s init
# Apply manifests to the current cluster context
nself k8s apply
# Deploy a new version
nself k8s deploy
# Check pod/service status
nself k8s statusnself k8s <SUBCOMMAND> [FLAGS]nself k8s translates the nSelf stack configuration into Kubernetes-native resources (Deployments, StatefulSets, Services, Ingress, ConfigMaps, Secrets, PersistentVolumeClaims) and packages them as a Helm chart under k8s/chart/. It reads the same .env.* environment cascade as the Docker Compose path — no separate Kubernetes-only config is required.
Use nself infra provision to create the server, then nself k8s init to set up Kubernetes on it. Existing Docker Compose stacks can be converted in-place with nself k8s convert.
Cluster management via k8s cluster targets Hetzner Kubernetes (K3s on VPS) by default. Namespace operations let you isolate multiple nSelf projects on a shared cluster.
Set up Kubernetes support in the current project. Installs K3s on the target server and generates the initial Helm chart.
nself k8s init
nself k8s init --env stagingConvert the current Docker Compose project to Kubernetes manifests and a Helm chart. Non-destructive — Docker Compose files are preserved.
nself k8s convert
nself k8s convert --output ./k8s/chart --namespace my-appApply the generated manifests to the current kubectl context. Equivalent to helm upgrade --install.
nself k8s apply
nself k8s apply --dry-run # show what would change without applyingBuild images, push to the registry, and roll out the update. Watches for rollout completion and exits non-zero on timeout.
nself k8s deploy
nself k8s deploy --timeout 300 # wait up to 5 minutes for rolloutPrint the state of all pods, services, and persistent volume claims in the nSelf namespace.
nself k8s status
# POD READY STATUS RESTARTS AGE
# nself-postgres-0 1/1 Running 0 3d
# nself-hasura-7d9f6c-xk2p4 1/1 Running 0 2d
# nself-auth-5b8f9d-vqm7j 1/1 Running 0 2d
# nself-nginx-6c4b88-r8zn2 1/1 Running 0 2dTail logs from a pod or all pods in the nSelf namespace. Wraps kubectl logs with nSelf-aware service names.
nself k8s logs hasura
nself k8s logs --all --follow
nself k8s logs hasura --since 1hScale the replica count for a specific service deployment.
nself k8s scale hasura --replicas 3
nself k8s scale nginx --replicas 2Roll back the Helm release to the previous revision.
nself k8s rollback
nself k8s rollback --revision 5 # roll back to a specific revisionUninstall the Helm release and delete all resources in the namespace. Persistent volumes are retained by default.
nself k8s delete
nself k8s delete --include-volumes # also delete PVCs (data loss)Manage the underlying Kubernetes cluster on a Hetzner VPS.
| Sub-action | Description |
|---|---|
cluster create | Provision a new VPS and install K3s |
cluster destroy | Destroy the cluster server (confirmation required) |
cluster info | Print cluster endpoint, version, and node count |
nself k8s cluster create --provider hetzner --type cx23
nself k8s cluster info
nself k8s cluster destroy --forceManage Kubernetes namespaces for multi-project clusters.
| Sub-action | Description |
|---|---|
namespace list | List all namespaces in the cluster |
namespace use <name> | Set the active namespace for subsequent k8s commands |
namespace create <name> | Create a new namespace |
nself k8s namespace list
nself k8s namespace create staging
nself k8s namespace use staging| Flag | Type | Default | Description |
|---|---|---|---|
--env | string | current | Target environment: local, staging, prod |
--namespace | string | nself | Kubernetes namespace |
--output | string | ./k8s/chart | Output path for generated Helm chart (convert) |
--dry-run | bool | false | Show changes without applying (apply) |
--timeout | int | 180 | Rollout wait timeout in seconds (deploy) |
--replicas | int | — | Target replica count (scale) |
--revision | int | previous | Helm revision to roll back to (rollback) |
--follow | bool | false | Stream logs continuously (logs) |
--since | string | — | Show logs from duration ago, e.g. 1h, 30m (logs) |
--include-volumes | bool | false | Also delete PVCs when deleting (delete) |
--force | bool | false | Skip confirmation (delete, cluster destroy) |
--json | bool | false | JSON output (status, namespace list) |
# From an existing nSelf project dir:
nself k8s convert
nself k8s cluster create --provider hetzner --type cx23
nself k8s applynself k8s deploy --timeout 300 && echo "deploy OK" || nself k8s rollbacknself k8s namespace create staging
nself k8s namespace use staging
nself k8s apply --env stagingnself k8s scale hasura --replicas 3KUBECONFIG — path to kubeconfig file (default: ~/.kube/config)NSELF_K8S_NAMESPACE — default namespace (overrides --namespace)HETZNER_NSELF_TOKEN — Hetzner token for cluster provisioning0 — success1 — Kubernetes API or Helm error2 — invalid arguments or missing subcommand3 — cluster not reachable (kubeconfig missing or expired)4 — rollout timed out (deploy)