# Packages and clusters

In many Kubernetes repositories, application flags, cloud storage classes, ingress annotations, and node-sizing rules end up mixed in the same Helm values file or Kustomize overlay. Moving a service from a laptop cluster to production then requires editing the application's own files. Kix separates configuration into three layers: reusable **packages**, **cluster** composition, and platform **flavors**.

<Video
  title="Packages and clusters"
  duration="4:07"
  src="https://media.kix.run/videos/explanation-packages-and-clusters/v3/explanation-packages-and-clusters.mp4"
  poster="https://media.kix.run/videos/explanation-packages-and-clusters/v3/poster.webp"
  captions="https://media.kix.run/videos/explanation-packages-and-clusters/v3/captions.en.vtt"
/>

## Separating application design from cluster decisions

Running software on Kubernetes involves three distinct sets of decisions. Mixing them in one file makes configuration hard to reuse across environments.

**Packages** define what the software needs to run: container images, ports, health probes, configuration options, and abstract requirements such as a PostgreSQL database or persistent storage. **Clusters** assemble a platform: they declare namespaces, choose which database operator or ingress controller satisfies those requirements, and set security policies. **Flavors** describe the Kubernetes environment underneath: whether it runs on one laptop node or across multiple cloud zones, and which networking, DNS, or storage services the platform already supplies.

Keeping each decision in its own layer makes packages portable. A package asks for persistent storage without hardcoding an AWS storage class name, and the cluster chooses how to provision that disk on AWS or bare metal. Putting workloads in packages keeps the cluster file focused on instances and wiring, so you can instantiate the same stack for preview and production. Flavors describe only platform capabilities and built-in services, so switching a cluster from kind to EKS never alters application settings unexpectedly.

## Packages versus instances

A package is a reusable definition; a package instance is one configured copy of that package inside a namespace. If a cluster runs two Valkey caches in two namespaces, both use the same Valkey package, and Kix evaluates each instance in its own scope so resource names and pod labels never collide.

Packages stay independent because they never reach into another package's internal Deployments or ConfigMaps. Each package declares its required and optional dependencies and reads only the public outputs those dependencies publish, such as a hostname, port, or Secret key reference. Kix also marks package stability in the catalog: stable packages make breaking changes only in minor releases, while experimental packages sit under an explicit experimental namespace in your cluster file so you can see where options may still change.

## Kix as a strict Kubernetes superset

Kix compiles high-level cluster definitions into standard Kubernetes manifests and acts as a strict superset of Kubernetes.

Whenever Kubernetes already defines a field for an intent, Kix uses real Kubernetes resource kinds and spec fields. Kix strips its build-time dependency annotations before applying manifests to the API server and stores that metadata in its own deployment records instead. Exporting a compiled cluster writes ordinary Kubernetes YAML that standard tools and controllers understand directly.

Kix's helper builders automate repetitive cross-field checks while keeping standard Kubernetes structure visible. When a package builds a Deployment and a Service, Kix aligns pod template labels, Service selectors, and container ports automatically, and verifies that resource limits are at least as large as requests.

## What Kix refuses to guess

To keep builds predictable when you review diffs or work with coding agents, Kix sets three limits on its own automation.

First, Kix does not guess on resources. Helpers derive values only from explicit links, never by guessing which of five container ports should be exposed publicly or which Secret in a namespace holds a database password. Second, ambiguity stops the build. If two databases in a namespace could both satisfy an application's dependency, local checks stop and ask you to name the target instance.

Third, escape hatches stay open at every layer. When you need a new Kubernetes field, custom resource, or upstream flag that a helper or package option does not model yet, you can pass raw Kubernetes fields or overlay resource attributes directly without waiting for a Kix release. Kix still validates the rest of the resource graph around those overrides.

Next, read [The dependency graph](/docs/concepts/the-dependency-graph/) to see how resource references drive rollout order and firewall rules. For builder schemas and escape hatches, see [Package anatomy](/docs/reference/package-anatomy/) and [Instances and composition](/docs/reference/instances-and-composition/).