Skip to content
Install the CLI

Concept Policy, networking, and operations

Server-side apply and drift

In a live Kubernetes cluster, your deployment tool is rarely the only writer modifying objects. Autoscalers adjust replica counts during traffic spikes, operators inject webhook certificates into custom resource definitions, and the Kubernetes API server fills in default pod fields. Kix uses Kubernetes Server-Side Apply to track ownership field by field, detecting out-of-band changes to Kix-owned fields without overwriting controller updates or flagging API server defaults.

Sharing live objects safely with controllers

Section titled “Sharing live objects safely with controllers”

Kix applies manifests with Kubernetes Server-Side Apply under a field manager named after your Kix cluster. The Kubernetes API server records field ownership individually, so Kix can own a Deployment’s container image, environment variables, and resource requests while a HorizontalPodAutoscaler owns the replica count on that same Deployment.

When two writers try to set the same field, Kubernetes returns a field ownership conflict instead of letting one overwrite the other silently. How you handle a conflict depends on who should own the field:

  • When Kix should own the field: If someone edited a Kix-managed field in the cluster with kubectl, Kix’s plan shows the modified field and field manager, and deploying takes the field back after checking that nothing else changed since the plan ran. When adopting an existing resource into Kix for the first time, passing a one-time conflict-transfer flag hands field ownership to Kix.
  • When an in-cluster controller should own the field: For fields such as an autoscaled Deployment’s replica count or webhook conversion settings on a custom resource definition, the package cedes ownership of that field path to the controller. Kix sends an initial value when creating the object, omits controller-owned fields on later deploys (including forced ones), and never treats controller updates on those paths as drift.

Detecting real drift without noisy annotations

Section titled “Detecting real drift without noisy annotations”

Comparing desired YAML against an entire live object produces constant false positives from controller status updates and API server defaults. Kix hashes and compares only the live fields owned by its field manager, excluding fields ceded to controllers. Routine cluster updates produce no noise, while out-of-band edits to Kix-owned fields show up immediately, even when checking status from a machine without the source repository.

Kix stores manifest and applied-field hashes in dedicated in-cluster revision records instead of writing tracking annotations onto live Deployments and Services. Keeping live workloads free of tracking annotations means changing one shared Secret or Service never rewrites metadata on unchanged downstream Deployments. It also lets multiple Kix clusters on the same Kubernetes cluster share objects such as a Namespace or ClusterRole: matching field values co-exist, conflicting values fail the deploy immediately, and pruning keeps the shared object until the last Kix cluster removes it.

Kix avoids hidden inputs at deploy time as well as hidden state in the cluster. Every input that affects a compiled manifest, including frequently updated container image digests, lives in a committed file in Git and is read during build evaluation.

To support automated image updates without CI bots editing Nix expressions, Kix stores image tags and sha256 digests in a JSON pin file managed by Kix’s pin command. Because every library input and image digest is committed before compilation, the content-addressed manifest hashes in Kix’s local store always match what deploys to the cluster. When a deploy finishes, Kix writes a receipt onto the cluster’s activation record with the build hash, Git commit, locked inputs, and image digests, so you can generate verifiable SLSA provenance attestations directly from the live cluster.

Next, build a local kind cluster in the Tutorials or browse the How-to guides for specific tasks. For revision schemas, upgrade migration details, and conflict flags, see Annotations, CRDs, and receipts.