How-to guide / Start and inspect a Kix project
Render manifests
These docs describe Kix's main branch, which can include changes not yet released. Read the docs for the latest release.
kix build evaluates a cluster and writes its rendered Kubernetes manifests to
standard output. It does not connect to a Kubernetes cluster.
Render the cluster
Section titled “Render the cluster”Run build with a cluster name:
❱ kix build how-to-application Show outputHide output · 429 lines
apiVersion: apps/v1
kind: Deployment
metadata:
annotations:
kix.run/depends-on: 8767b7nzgc1x5bpfa9gv71cpk9z8h0iw,asa4ywz8yjjql7grm2rnm774q96ncs3m
kix.run/identity-hash: hd2br513fjyfgbl9sf97ank37hqzrmzl
kix.run/package: preview
kix.run/package-namespace: how-to-app
labels:
app.kubernetes.io/instance: preview
app.kubernetes.io/managed-by: kix
app.kubernetes.io/name: preview
name: preview
namespace: how-to-app
spec:
replicas: 1
selector:
matchLabels:
app.kubernetes.io/instance: preview
app.kubernetes.io/name: preview
template:
metadata:
labels:
app.kubernetes.io/instance: preview
app.kubernetes.io/name: preview
spec:
containers:
- env:
- name: APP_ENV
value: preview
image: docker.io/library/nginx:1.27-alpine
imagePullPolicy: IfNotPresent
name: nginx
ports:
- containerPort: 80
name: http
protocol: TCP
readinessProbe:
httpGet:
path: /
port: http
resources:
limits:
memory: 64Mi
requests:
cpu: 10m
memory: 16Mi
volumeMounts:
- mountPath: /usr/share/nginx/html
name: content
readOnly: true
volumes:
- configMap:
name: preview
name: content
---
apiVersion: apps/v1
kind: Deployment
metadata:
annotations:
kix.run/depends-on: 4x75h2z7rsj3dvrdg9vzqc8l789xvm4w,8767b7nzgc1x5bpfa9gv71cpk9z8h0iw
kix.run/identity-hash: kr7i34wz1ja58c0vf9gizx8161ji0idk
kix.run/package: production
kix.run/package-namespace: how-to-app
labels:
app.kubernetes.io/instance: production
app.kubernetes.io/managed-by: kix
app.kubernetes.io/name: production
name: production
namespace: how-to-app
spec:
replicas: 2
selector:
matchLabels:
app.kubernetes.io/instance: production
app.kubernetes.io/name: production
template:
metadata:
labels:
app.kubernetes.io/instance: production
app.kubernetes.io/name: production
spec:
containers:
- env:
- name: APP_ENV
value: production
image: docker.io/library/nginx:1.27-alpine
imagePullPolicy: IfNotPresent
name: nginx
ports:
- containerPort: 80
name: http
protocol: TCP
readinessProbe:
httpGet:
path: /
port: http
resources:
limits:
memory: 64Mi
requests:
cpu: 10m
memory: 16Mi
volumeMounts:
- mountPath: /usr/share/nginx/html
name: content
readOnly: true
volumes:
- configMap:
name: production
name: content
---
apiVersion: batch/v1
kind: Job
metadata:
annotations:
kix.run/depends-on: 8767b7nzgc1x5bpfa9gv71cpk9z8h0iw,cd3l507fvaf0wg5azfza49x6wjsiiynz,dlzbv1nahmar8f7b9jm6rmyvmqczmzdb,requires:mkgdf3yajj0a92l7fspcy7ciykw4dsl1
kix.run/identity-hash: wpz10gpqzpm03j9h0brcczwjsgdrh5nx
kix.run/package: production
kix.run/package-namespace: how-to-app
kix.run/rerun: on-change
kix.run/rerun-hash: 292bf91166ffd91051bafff4ba2a7a72fdbeede631f2da422b20c2b243fdf576
labels:
app.kubernetes.io/component: health-check
app.kubernetes.io/instance: production
app.kubernetes.io/managed-by: kix
app.kubernetes.io/name: production-health
name: production-health
namespace: how-to-app
spec:
activeDeadlineSeconds: 150
backoffLimit: 0
template:
metadata:
annotations:
checksum/root: 670ec54e5945f89e2c6d0b47732acc448c40a80f51ef86c0d0eb2affd4924726
labels:
app.kubernetes.io/component: health-check
app.kubernetes.io/name: production-health
spec:
automountServiceAccountToken: false
containers:
- command:
- /bin/sh
- -eu
- /probe/health-check.sh
env:
- name: APP_URL
value: http://production.how-to-app.svc.cluster.local:80
- name: RETRY_FOR
value: "60"
image: docker.io/curlimages/curl:8.14.1@sha256:9a1ed35addb45476afa911696297f8e115993df459278ed036182dd2cd22b67b
name: probe
resources:
limits:
memory: 128Mi
requests:
cpu: 50m
memory: 64Mi
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
readOnlyRootFilesystem: true
runAsNonRoot: true
terminationMessagePolicy: FallbackToLogsOnError
volumeMounts:
- mountPath: /probe
name: production-health-script
readOnly: true
restartPolicy: Never
securityContext:
runAsGroup: 65534
runAsNonRoot: true
runAsUser: 65534
seccompProfile:
type: RuntimeDefault
volumes:
- configMap:
name: production-health-script
name: production-health-script
---
apiVersion: kix.run/v1alpha1
kind: Activation
metadata:
annotations:
kix.run/built-via: /nix/store/cfsz61k09jk66zw1bv31hdcjx4km9ma2-kix-activation-how-to-application.json
kix.run/depends-on: 4sq8laq4iq1acp2kfbc1jidw8h96hb2a,61mwr4ycvjf6kzzdnqf1qjr5kxyhagij,mkgdf3yajj0a92l7fspcy7ciykw4dsl1,s2js1l6lgip2vjqin6m77sabq0lvkb9j
kix.run/identity-hash: 6n94gibgl7zv48rik94xki1n0svd3azy
kix.run/package: _cluster
kix.run/package-namespace: _cluster
labels:
app.kubernetes.io/managed-by: kix
kix.run/cluster: how-to-application
name: how-to-application-6n94gibgl7zv
spec:
instances:
how-to-app:
preview: preview
production: production
kube-system:
platform-dns: platform-dns
platform-storage: platform-storage
---
apiVersion: kix.run/v1alpha1
kind: PackageInstance
metadata:
annotations:
kix.run/depends-on: 8767b7nzgc1x5bpfa9gv71cpk9z8h0iw,91lbws8gjsbxfvr8p7kjx0dc7nzybhqs
kix.run/identity-hash: s2js1l6lgip2vjqin6m77sabq0lvkb9j
kix.run/package: _cluster
kix.run/package-namespace: _cluster
kix.run/root: preview
labels:
app.kubernetes.io/instance: preview
app.kubernetes.io/managed-by: kix
name: preview
namespace: how-to-app
spec:
instanceName: preview
namespaceName: how-to-app
version: "1.0.0"
---
apiVersion: kix.run/v1alpha1
kind: PackageInstance
metadata:
annotations:
kix.run/depends-on: 8767b7nzgc1x5bpfa9gv71cpk9z8h0iw,cd3l507fvaf0wg5azfza49x6wjsiiynz,wpz10gpqzpm03j9h0brcczwjsgdrh5nx
kix.run/identity-hash: 61mwr4ycvjf6kzzdnqf1qjr5kxyhagij
kix.run/inverse-deps: Job/production-health
kix.run/package: _cluster
kix.run/package-namespace: _cluster
kix.run/root: production
labels:
app.kubernetes.io/instance: production
app.kubernetes.io/managed-by: kix
name: production
namespace: how-to-app
spec:
instanceName: production
namespaceName: how-to-app
version: "1.0.0"
---
apiVersion: kix.run/v1alpha1
kind: PackageInstance
metadata:
annotations:
kix.run/depends-on: sj0fv5bs2hnh9zcqdh62ph34l2wm0b1m
kix.run/identity-hash: mkgdf3yajj0a92l7fspcy7ciykw4dsl1
kix.run/import-apiversion: v1
kix.run/import-fqdn: kube-dns.kube-system.svc.cluster.local
kix.run/import-kind: Service
kix.run/import-name: kube-dns
kix.run/mode: import
kix.run/package: _cluster
kix.run/package-namespace: _cluster
labels:
app.kubernetes.io/instance: platform-dns
app.kubernetes.io/managed-by: kix
name: platform-dns
namespace: kube-system
spec:
instanceName: platform-dns
mode: import
namespaceName: kube-system
---
apiVersion: kix.run/v1alpha1
kind: PackageInstance
metadata:
annotations:
kix.run/depends-on: sj0fv5bs2hnh9zcqdh62ph34l2wm0b1m
kix.run/identity-hash: 4sq8laq4iq1acp2kfbc1jidw8h96hb2a
kix.run/import-apiversion: storage.k8s.io/v1
kix.run/import-kind: StorageClass
kix.run/import-name: standard
kix.run/mode: import
kix.run/package: _cluster
kix.run/package-namespace: _cluster
labels:
app.kubernetes.io/instance: platform-storage
app.kubernetes.io/managed-by: kix
name: platform-storage
namespace: kube-system
spec:
instanceName: platform-storage
mode: import
namespaceName: kube-system
---
apiVersion: v1
data:
index.html: |
Hello from preview
kind: ConfigMap
metadata:
annotations:
kix.run/depends-on: 8767b7nzgc1x5bpfa9gv71cpk9z8h0iw
kix.run/identity-hash: asa4ywz8yjjql7grm2rnm774q96ncs3m
kix.run/package: preview
kix.run/package-namespace: how-to-app
labels:
app.kubernetes.io/instance: preview
app.kubernetes.io/managed-by: kix
name: preview
namespace: how-to-app
---
apiVersion: v1
data:
index.html: |
Hello from production
kind: ConfigMap
metadata:
annotations:
kix.run/depends-on: 8767b7nzgc1x5bpfa9gv71cpk9z8h0iw
kix.run/identity-hash: 4x75h2z7rsj3dvrdg9vzqc8l789xvm4w
kix.run/package: production
kix.run/package-namespace: how-to-app
labels:
app.kubernetes.io/instance: production
app.kubernetes.io/managed-by: kix
name: production
namespace: how-to-app
---
apiVersion: v1
data:
health-check.sh: |
#!/bin/sh
# region:healthCheckScript
set -u
deadline=$(( $(date +%s) + RETRY_FOR ))
while true; do
if curl --fail --silent --show-error --max-time 10 "$APP_URL" >/dev/null; then
echo "ok GET $APP_URL"
exit 0
fi
echo "FAIL GET $APP_URL"
if [ "$(date +%s)" -ge "$deadline" ]; then
echo "gave up after ${RETRY_FOR}s"
exit 1
fi
sleep 5
done
# endregion:healthCheckScript
kind: ConfigMap
metadata:
annotations:
kix.run/depends-on: 8767b7nzgc1x5bpfa9gv71cpk9z8h0iw
kix.run/identity-hash: dlzbv1nahmar8f7b9jm6rmyvmqczmzdb
kix.run/package: production
kix.run/package-namespace: how-to-app
labels:
app.kubernetes.io/instance: production
app.kubernetes.io/managed-by: kix
name: production-health-script
namespace: how-to-app
---
apiVersion: v1
kind: Namespace
metadata:
annotations:
kix.run/identity-hash: 8767b7nzgc1x5bpfa9gv71cpk9z8h0iw
kix.run/package: _cluster
kix.run/package-namespace: _cluster
labels:
app.kubernetes.io/managed-by: kix
kubernetes.io/metadata.name: how-to-app
name: how-to-app
---
apiVersion: v1
kind: Namespace
metadata:
annotations:
kix.run/identity-hash: sj0fv5bs2hnh9zcqdh62ph34l2wm0b1m
kix.run/package: _cluster
kix.run/package-namespace: _cluster
labels:
app.kubernetes.io/managed-by: kix
kubernetes.io/metadata.name: kube-system
name: kube-system
---
apiVersion: v1
kind: Service
metadata:
annotations:
kix.run/depends-on: 8767b7nzgc1x5bpfa9gv71cpk9z8h0iw,hd2br513fjyfgbl9sf97ank37hqzrmzl
kix.run/identity-hash: 91lbws8gjsbxfvr8p7kjx0dc7nzybhqs
kix.run/package: preview
kix.run/package-namespace: how-to-app
labels:
app.kubernetes.io/instance: preview
app.kubernetes.io/managed-by: kix
name: preview
namespace: how-to-app
spec:
ports:
- name: http
port: 80
protocol: TCP
selector:
app.kubernetes.io/instance: preview
app.kubernetes.io/name: preview
type: ClusterIP
---
apiVersion: v1
kind: Service
metadata:
annotations:
kix.run/depends-on: 8767b7nzgc1x5bpfa9gv71cpk9z8h0iw,kr7i34wz1ja58c0vf9gizx8161ji0idk
kix.run/identity-hash: cd3l507fvaf0wg5azfza49x6wjsiiynz
kix.run/package: production
kix.run/package-namespace: how-to-app
labels:
app.kubernetes.io/instance: production
app.kubernetes.io/managed-by: kix
name: production
namespace: how-to-app
spec:
ports:
- name: http
port: 80
protocol: TCP
selector:
app.kubernetes.io/instance: production
app.kubernetes.io/name: production
type: ClusterIP The default output is a multi-document YAML stream. It includes workload resources, package bookkeeping, cluster-scoped resources, and imports used for dependency ordering.
Redirect the stream when another tool or review process needs a file:
❱ kix build how-to-application > manifests.yaml The file is ordinary Kubernetes YAML. Apply it only if your workflow intends to bypass Kix’s deployment planning, readiness handling, activation records, and pruning controls.
Choose an output format
Section titled “Choose an output format”Use --output to select a representation:
❱ kix build how-to-application --output yaml❱ kix build how-to-application --output json JSON is useful when another program needs to inspect the rendered objects. This excerpt shows the production Deployment from the complete result:
❱ kix build how-to-application -o json
{
"apiVersion": "apps/v1",
"kind": "Deployment",
"metadata": {
"annotations": {
"kix.run/depends-on": "4x75h2z7rsj3dvrdg9vzqc8l789xvm4w,8767b7nzgc1x5bpfa9gv71cpk9z8h0iw",
"kix.run/identity-hash": "kr7i34wz1ja58c0vf9gizx8161ji0idk",
"kix.run/package": "production",
"kix.run/package-namespace": "how-to-app"
},
"labels": {
"app.kubernetes.io/instance": "production",
"app.kubernetes.io/managed-by": "kix",
"app.kubernetes.io/name": "production"
},
"name": "production",
"namespace": "how-to-app"
},
"spec": {
"replicas": 2,
"selector": {
"matchLabels": {
"app.kubernetes.io/instance": "production",
"app.kubernetes.io/name": "production"
}
},
"template": {
"metadata": {
"labels": {
"app.kubernetes.io/instance": "production",
"app.kubernetes.io/name": "production"
}
},
"spec": {
"containers": [
{
"env": [
{
"name": "APP_ENV",
"value": "production"
}
],
"image": "docker.io/library/nginx:1.27-alpine",
"imagePullPolicy": "IfNotPresent",
"name": "nginx",
"ports": [
{
"containerPort": 80,
"name": "http",
"protocol": "TCP"
}
],
"readinessProbe": {
"httpGet": {
"path": "/",
"port": "http"
}
},
"resources": {
"limits": {
"memory": "64Mi"
},
"requests": {
"cpu": "10m",
"memory": "16Mi"
}
},
"volumeMounts": [
{
"mountPath": "/usr/share/nginx/html",
"name": "content",
"readOnly": true
}
]
}
],
"volumes": [
{
"configMap": {
"name": "production"
},
"name": "content"
}
]
}
}
}
} The rendered Deployment reflects the package options, generated environment variables, ConfigMap mount, and instance-specific replica count.
Render a flake elsewhere
Section titled “Render a flake elsewhere”Pass --flake when the current directory is not the project root:
❱ kix build how-to-application --flake ../infrastructure Kix evaluates the requested flake without changing the shell’s working directory.
Validate before deployment
Section titled “Validate before deployment”build proves that evaluation and rendering succeed. Run check when you also
want the summary of cluster evaluation, always-on validation checks, and
scorecard policy findings:
❱ kix check how-to-application
TOOL RESULT DETAILS
eval pass 15 manifests evaluated
scorecard pass 0 errors, 11 warnings, 2 info
governance.hasOwner (warning), 2:
how-to-app/preview: package 'preview' has no meta.owner
how-to-app/production: package 'production' has no meta.owner
reliability.boundedResources (warning), 2:
how-to-app/preview/preview: container 'nginx' is missing resource settings: limits.cpu. Set CPU and memory requests and limits.
how-to-app/production/production: container 'nginx' is missing resource settings: limits.cpu. Set CPU and memory requests and limits.
reliability.hasProbes (warning), 2:
how-to-app/preview/preview: container 'nginx' has no livenessProbe
how-to-app/production/production: container 'nginx' has no livenessProbe
security.hasNetworkPolicy (warning), 1:
how-to-app: namespace 'how-to-app' has workloads but no network policy
security.nonRoot (warning), 2:
how-to-app/preview/preview: container 'nginx' may run as root: neither it nor the pod sets securityContext.runAsNonRoot, and no non-zero runAsUser resolves for it
how-to-app/production/production: container 'nginx' may run as root: neither it nor the pod sets securityContext.runAsNonRoot, and no non-zero runAsUser resolves for it
security.readOnlyRootfs (warning), 2:
how-to-app/preview/preview: container 'nginx' does not set readOnlyRootFilesystem
how-to-app/production/production: container 'nginx' does not set readOnlyRootFilesystem
2 info finding(s) not listed; run with -v to list them.