The nself k8s command group generates Kubernetes manifests and Helm charts from your existing ɳSelf stack, and provides shortcuts for deploying to a cluster using your current environment configuration. Docker Compose is still used locally; K8s is the target for staging and production when you need orchestrated scaling.
docker-compose.yml to K8s manifestsnself env for valuesnself build first. The K8s manifests are generated from the same docker-compose.yml that nself build produces. Without a current build, the generated manifests will be stale.# 1. Build your stack (required before k8s commands)
nself build
# 2. Generate Kubernetes manifests
nself k8s generate --output k8s/
# 3. Review the generated manifests
ls k8s/
# 4. Apply to your cluster
kubectl apply -f k8s/
# Or use Helm
nself k8s helm # Generate chart
helm install nself ./nself-chartConvert the current stack to Kubernetes manifests.
nself k8s generate [options]
# Options:
# --output <dir> Output directory (default: k8s/)
# --namespace <ns> Kubernetes namespace (default: nself)
# --env <env> Environment to use (default: active env)
# --ingress <class> Ingress class: nginx, traefik, alb
# --storage <class> Storage class for PVCs (default: standard)
# Examples
nself k8s generate --output manifests/prod
nself k8s generate --namespace production --ingress nginx
nself k8s generate --env staging --output k8s/stagingk8s/
├── namespace.yaml # Namespace definition
├── configmap.yaml # Non-secret config from .env
├── secrets.yaml # Kubernetes Secret (base64)
├── services/
│ ├── postgres.yaml # StatefulSet + Service
│ ├── hasura.yaml # Deployment + Service
│ ├── auth.yaml # Deployment + Service
│ ├── nginx.yaml # Deployment + Service + Ingress
│ ├── redis.yaml # StatefulSet + Service (if enabled)
│ ├── minio.yaml # StatefulSet + Service (if enabled)
│ └── plugins/
│ └── ai.yaml # Per-plugin Deployment + Service
├── storage/
│ ├── postgres-pvc.yaml # Persistent volume claim
│ └── minio-pvc.yaml # Storage PVC (if enabled)
└── ingress.yaml # Unified Ingress for all routesGenerate a Helm chart instead of raw manifests.
nself k8s helm [options]
# Options:
# --output <dir> Chart output directory (default: nself-chart/)
# --chart-name <name> Chart name (default: nself)
# --chart-version <v> Chart version (default: CLI version)
# Examples
nself k8s helm --output ./charts
nself k8s helm --chart-name myapp --chart-version 1.0.0nself-chart/
├── Chart.yaml # Chart metadata
├── values.yaml # Default values (from .env)
├── values.staging.yaml # Staging overrides
├── values.prod.yaml # Production overrides
└── templates/
├── _helpers.tpl
├── namespace.yaml
├── configmap.yaml
├── secret.yaml
├── postgres.yaml
├── hasura.yaml
├── auth.yaml
├── nginx.yaml
└── plugins/Show the status of the ɳSelf deployment on the active cluster.
nself k8s status [options]
# Options:
# --namespace <ns> Kubernetes namespace (default: nself)
# --context <ctx> kubectl context
# Output:
# ɳSelf on cluster: my-cluster (production)
# Namespace: nself
#
# RESOURCE READY AGE
# postgres 1/1 14d
# hasura 2/2 14d
# auth 1/1 14d
# nginx 2/2 14d
# plugin-ai 1/1 7dList available kubectl contexts.
nself k8s contextsApply generated manifests to the cluster. Equivalent to kubectl apply -f k8s/.
nself k8s apply [options]
# Options:
# --dir <dir> Manifest directory (default: k8s/)
# --namespace <ns> Namespace (default: nself)
# --dry-run Preview changes without applying
# Examples
nself k8s apply
nself k8s apply --dry-run
nself k8s apply --namespace productionTrigger a rolling update on a specific deployment.
nself k8s rollout <service> [options]
# Options:
# --namespace <ns> Kubernetes namespace
# Examples
nself k8s rollout hasura
nself k8s rollout nginx --namespace productionStream logs from a pod. Wraps kubectl logs with ɳSelf service awareness.
nself k8s logs <service> [options]
# Options:
# --tail <n> Lines to show (default: 50)
# --follow Follow log stream
# --namespace <ns> Namespace (default: nself)
# Examples
nself k8s logs hasura --follow
nself k8s logs postgres --tail 100Execute a command inside a pod.
nself k8s exec <service> -- <command>
# Examples
nself k8s exec postgres -- psql -U postgres -c 'l'
nself k8s exec hasura -- hasura-cli metadata exportThe generator sets conservative defaults. Override in values.yaml or pass custom limits:
# values.prod.yaml
resources:
postgres:
requests:
memory: "512Mi"
cpu: "250m"
limits:
memory: "2Gi"
cpu: "1000m"
hasura:
requests:
memory: "256Mi"
cpu: "100m"
limits:
memory: "1Gi"
cpu: "500m"| Variable | Description | Default |
|---|---|---|
| NSELF_K8S_NAMESPACE | Default Kubernetes namespace | nself |
| NSELF_K8S_CONTEXT | Default kubectl context | — |
| NSELF_K8S_OUTPUT | Default manifest output directory | k8s/ |