# Deploy to kind

Use kind to run a Kubernetes cluster in Docker for local Kix development. The
`kix-examples` repository includes a single-node kind configuration and clusters
that are safe to deploy together.

This guide assumes Docker, kind, kubectl, and Kix are installed.

## Create the cluster

From the `kix-examples` repository, create the configured cluster:

<Command
  commands={["kind create cluster --config kind-config.yaml"]}
  cwd="kix-examples/"
/>

The configuration names the cluster `kix-demo`. Kind creates the kubectl
context `kind-kix-demo` and selects it as the current context.

Confirm that kubectl can reach the API server:

<Command {...clusterInfo} />

If another context is current, select the kind context explicitly:

<Command commands={["kubectl config use-context kind-kix-demo"]} />

## Check the cluster definition

Validate the example before connecting Kix to Kubernetes:

<Command {...check} />

This evaluates the cluster and runs its configured validation without applying
resources.

## Deploy the application

Deploy the cluster and accept the plan:

<Command expandable {...deployApplication} />

Kix builds the manifests, compares them with the current activation, applies
resources in dependency order, waits for readiness, runs the production health
check, and records the new activation.

The captured deployment ends with the activation becoming `Active`. A failed
resource or post-deploy check prevents that transition.

## Inspect the result

Check the namespaces and workloads with kubectl:

<Command {...getNamespaces} />

<Command {...getWorkloads} />

Use Kix to check that every object of the deploy is on the cluster, unchanged,
and ready:

{/* Maintained by hand until the live capture how-to/application-status/status
    in docs/nix/captures.nix is regenerated against `kix status`. */}

<Command commands={["kix status how-to-application"]} cwd="kix-examples/" />

```text
Cluster how-to-application on Kubernetes v1.35.0 (context kind-kix-demo)
Last deploy: how-to-application-6rhi3wpk9iml  Active  2m ago

  how-to-app/preview              4 resources  ok
  how-to-app/production           6 resources  ok
  kube-system/platform-dns        1 resource   ok
  kube-system/platform-storage    1 resource   ok
  (cluster-level)                 4 resources  ok

16 resources: 16 ok.
```

## Remove the local cluster

When you no longer need it, delete the kind cluster:

<Command commands={["kind delete cluster --name kix-demo"]} />

This removes the local Kubernetes cluster and everything deployed into it. It
does not change the files in `kix-examples`.

:::note[Next steps]
See [Check a cluster's status](/docs/how-to/operate-a-cluster/check-resource-status/)
and [Preview changes with `kix plan`](/docs/how-to/operate-a-cluster/preview-changes-with-kix-plan/)
for the next operational tasks.
:::