Skip to content
Install the CLI

Reference experimental

nats

These docs describe Kix's main branch, which can include changes not yet released. Read the docs for the latest release.

Standalone or clustered NATS messaging server with JetStream persistence

This page is generated from kix/packages/experimental/nats.

StabilityExperimental
package valuepackages.experimental.nats
Default software version2.15.3
Default aliasesnats

Kix matches each dependency below to another package instance by instance name, alias, or role. To bind a specific instance, set deps.<name> in your cluster definition. See Declaring dependencies for how required and optional dependencies work.

DependencyRequirement
natsAuthRequired
prometheusOptional
storageClassesOptional

Run a NATS cluster of replicas servers (true) or one standalone server (false). Availability levels do not change clustered automatically: Kix rejects false at pod, node, or zone, and rejects true at none. NATS cannot convert a server with stored streams between standalone and clustered modes in place. To migrate an instance with data, back up every stream (nats stream backup), delete every stream (nats stream rm), delete the StatefulSet when moving from standalone to clustered (its PersistentVolumeClaims stay), change clustered and deploy, then restore the streams (nats stream restore).

  • Type: boolean
  • Default: false

Extra environment variables for the nats container. GOMEMLIMIT defaults to 80% of resources.limits.memory; set env.GOMEMLIMIT to override it. Kix rejects POD_NAME, NATS_USER, NATS_PASSWORD, AUTH_USER, and AUTH_PASSWORD, which this package sets itself.

  • Type: attribute set of (null or string or env var source with `valueFrom`)
  • Default: { }

Run a post-deploy Job that verifies the NATS instance through its client Service. The Job logs in, publishes and reads back a test message, queries JetStream account info when jetstream.enabled is true, and confirms that unauthenticated connections are rejected.

  • Type: boolean
  • Default: true

Seconds the probe keeps re-checking before it gives up, so a target still restarting from the rollout does not fail the deploy. The Job’s deadline is sized from it.

  • Type: signed integer
  • Default: 90

Container image for nats-server.

  • Type: submodule

  • Default:

    {
    digest = "sha256:558394a23dd3c36f2d3a64b51865fd09908010e80a542cea5e75c2af543ed62a";
    pullPolicy = "IfNotPresent";
    repository = "docker.io/library/nats";
    tag = "2.15.3-alpine";
    }

Resolved manifest digest, sha256: followed by 64 hex characters. What will actually run. Null means not resolved.

  • Type: null or string
  • Default: the package’s digest while tag is the package’s tag, otherwise null

Whatever a person wanted to say about this pin. Kix never reads it and a promotion never discards it. Declared here for the same reason as the three fields above: a pin carries its own record-keeping, and the option accepts the whole pin rather than a subset of it.

  • Type: null or string
  • Default: null

Who resolved this pin, for the record. Null when unknown.

  • Type: null or string
  • Default: null

imagePullPolicy for containers using this image. Null leaves it to Kubernetes.

  • Type: null or string
  • Default: "IfNotPresent"

Image repository, registry host included.

  • Type: string
  • Default: "docker.io/library/nats"

When this pin was resolved, RFC 3339. Null when unknown.

  • Type: null or string
  • Default: null

Revision of the source the image was built from, when Kix built it. Null for upstream images.

  • Type: null or string
  • Default: null

Image tag. What was asked for.

  • Type: string
  • Default: "2.15.3-alpine"

Enable JetStream persistence. When true, each pod mounts a PersistentVolumeClaim at /data for stream and consumer state. When false, the StatefulSet creates no volumes and serves core NATS (in-memory publish/subscribe) only.

  • Type: boolean
  • Default: true

Run the prometheus-nats-exporter sidecar in each pod. When the cluster also has a prometheus provider, Kix creates a metrics Service, a ServiceMonitor, and Prometheus alert rules. Changing metrics.enabled restarts the pods; adding or removing a prometheus provider does not.

  • Type: boolean
  • Default: true

Container image for the prometheus-nats-exporter sidecar.

  • Type: submodule

  • Default:

    {
    digest = "sha256:4b8ddc1c86fec360b5cd3d5e1fbc6fb52bdafd5805bba3901cc52926538af255";
    pullPolicy = "IfNotPresent";
    repository = "docker.io/natsio/prometheus-nats-exporter";
    tag = "0.20.3";
    }

Resolved manifest digest, sha256: followed by 64 hex characters. What will actually run. Null means not resolved.

  • Type: null or string
  • Default: the package’s digest while tag is the package’s tag, otherwise null

Whatever a person wanted to say about this pin. Kix never reads it and a promotion never discards it. Declared here for the same reason as the three fields above: a pin carries its own record-keeping, and the option accepts the whole pin rather than a subset of it.

  • Type: null or string
  • Default: null

Who resolved this pin, for the record. Null when unknown.

  • Type: null or string
  • Default: null

imagePullPolicy for containers using this image. Null leaves it to Kubernetes.

  • Type: null or string
  • Default: "IfNotPresent"

Image repository, registry host included.

  • Type: string
  • Default: "docker.io/natsio/prometheus-nats-exporter"

When this pin was resolved, RFC 3339. Null when unknown.

  • Type: null or string
  • Default: null

Revision of the source the image was built from, when Kix built it. Null for upstream images.

  • Type: null or string
  • Default: null

Image tag. What was asked for.

  • Type: string
  • Default: "0.20.3"

Scrape interval (e.g. ”30s”). Null = use Prometheus default.

  • Type: null or string
  • Default: null

Container resource requests and limits. Each field keeps its default until set, and null removes a default.

  • Type: submodule

  • Default:

    {
    limits = {
    cpu = "500m";
    memory = "128Mi";
    };
    requests = {
    cpu = "50m";
    memory = "64Mi";
    };
    }

Dynamic resource claims the container uses. Null leaves it unset.

  • Type: null or (list of (submodule))
  • Default: null

Name of an entry in the pod’s resourceClaims.

  • Type: string

Request within the claim to use. Null uses the whole claim.

  • Type: null or string
  • Default: null

Resource quantities by name.

  • Type: open submodule of attribute set of Kubernetes quantity, such as "500m" or "1Gi" (a non-negative decimal or integer with an optional suffix m, k, M, G, T, P, E, Ki, Mi, Gi, Ti, Pi or Ei)
  • Default: { }

The cpu quantity. Null leaves it unset.

  • Type: null or Kubernetes quantity, such as "500m" or "1Gi" (a non-negative decimal or integer with an optional suffix m, k, M, G, T, P, E, Ki, Mi, Gi, Ti, Pi or Ei)
  • Default: "500m"

metrics.resources.limits.ephemeral-storage

Section titled “metrics.resources.limits.ephemeral-storage”

The ephemeral-storage quantity. Null leaves it unset.

  • Type: null or Kubernetes quantity, such as "500m" or "1Gi" (a non-negative decimal or integer with an optional suffix m, k, M, G, T, P, E, Ki, Mi, Gi, Ti, Pi or Ei)
  • Default: null

The memory quantity. Null leaves it unset.

  • Type: null or Kubernetes quantity, such as "500m" or "1Gi" (a non-negative decimal or integer with an optional suffix m, k, M, G, T, P, E, Ki, Mi, Gi, Ti, Pi or Ei)
  • Default: "128Mi"

Resource quantities by name.

  • Type: open submodule of attribute set of Kubernetes quantity, such as "500m" or "1Gi" (a non-negative decimal or integer with an optional suffix m, k, M, G, T, P, E, Ki, Mi, Gi, Ti, Pi or Ei)
  • Default: { }

The cpu quantity. Null leaves it unset.

  • Type: null or Kubernetes quantity, such as "500m" or "1Gi" (a non-negative decimal or integer with an optional suffix m, k, M, G, T, P, E, Ki, Mi, Gi, Ti, Pi or Ei)
  • Default: "50m"

metrics.resources.requests.ephemeral-storage

Section titled “metrics.resources.requests.ephemeral-storage”

The ephemeral-storage quantity. Null leaves it unset.

  • Type: null or Kubernetes quantity, such as "500m" or "1Gi" (a non-negative decimal or integer with an optional suffix m, k, M, G, T, P, E, Ki, Mi, Gi, Ti, Pi or Ei)
  • Default: null

The memory quantity. Null leaves it unset.

  • Type: null or Kubernetes quantity, such as "500m" or "1Gi" (a non-negative decimal or integer with an optional suffix m, k, M, G, T, P, E, Ki, Mi, Gi, Ti, Pi or Ei)
  • Default: "64Mi"

Number of NATS server pods. Must be 1 when clustered is false, and an odd number of at least 3 when clustered is true.

  • Type: positive integer, meaning >0
  • Default: 3 when clustered is true, otherwise 1

CPU and memory requests and limits for the nats container. The defaults (500m CPU and 1Gi memory) are sized for development. For production JetStream clusters, upstream NATS recommends equal requests and limits of at least 2 CPU and 8Gi memory. limits.memory also sets the default GOMEMLIMIT (80% of the limit).

  • Type: submodule

  • Default:

    {
    limits = {
    cpu = "500m";
    memory = "1Gi";
    };
    requests = {
    cpu = "500m";
    memory = "1Gi";
    };
    }

Dynamic resource claims the container uses. Null leaves it unset.

  • Type: null or (list of (submodule))
  • Default: null

Name of an entry in the pod’s resourceClaims.

  • Type: string

Request within the claim to use. Null uses the whole claim.

  • Type: null or string
  • Default: null

Resource quantities by name.

  • Type: open submodule of attribute set of Kubernetes quantity, such as "500m" or "1Gi" (a non-negative decimal or integer with an optional suffix m, k, M, G, T, P, E, Ki, Mi, Gi, Ti, Pi or Ei)
  • Default: { }

The cpu quantity. Null leaves it unset.

  • Type: null or Kubernetes quantity, such as "500m" or "1Gi" (a non-negative decimal or integer with an optional suffix m, k, M, G, T, P, E, Ki, Mi, Gi, Ti, Pi or Ei)
  • Default: "500m"

The ephemeral-storage quantity. Null leaves it unset.

  • Type: null or Kubernetes quantity, such as "500m" or "1Gi" (a non-negative decimal or integer with an optional suffix m, k, M, G, T, P, E, Ki, Mi, Gi, Ti, Pi or Ei)
  • Default: null

The memory quantity. Null leaves it unset.

  • Type: null or Kubernetes quantity, such as "500m" or "1Gi" (a non-negative decimal or integer with an optional suffix m, k, M, G, T, P, E, Ki, Mi, Gi, Ti, Pi or Ei)
  • Default: "1Gi"

Resource quantities by name.

  • Type: open submodule of attribute set of Kubernetes quantity, such as "500m" or "1Gi" (a non-negative decimal or integer with an optional suffix m, k, M, G, T, P, E, Ki, Mi, Gi, Ti, Pi or Ei)
  • Default: { }

The cpu quantity. Null leaves it unset.

  • Type: null or Kubernetes quantity, such as "500m" or "1Gi" (a non-negative decimal or integer with an optional suffix m, k, M, G, T, P, E, Ki, Mi, Gi, Ti, Pi or Ei)
  • Default: "500m"

The ephemeral-storage quantity. Null leaves it unset.

  • Type: null or Kubernetes quantity, such as "500m" or "1Gi" (a non-negative decimal or integer with an optional suffix m, k, M, G, T, P, E, Ki, Mi, Gi, Ti, Pi or Ei)
  • Default: null

The memory quantity. Null leaves it unset.

  • Type: null or Kubernetes quantity, such as "500m" or "1Gi" (a non-negative decimal or integer with an optional suffix m, k, M, G, T, P, E, Ki, Mi, Gi, Ti, Pi or Ei)
  • Default: "1Gi"

Extra nats.conf settings merged over this package’s defaults. Keys in settings, settings.cluster, and settings.jetstream must be lowercase. When NATS accepts aliases for a key (such as max_file for max_file_store), use max_file_store (the primary name). Kix rejects top-level settings that this package manages (ports, listen addresses, client_advertise, http_base_path, server_name, pid_file, lame duck timings, store_dir, log files, syslog, ports_file_dir, and client authentication) or does not support (remote syslog, the profiling port, client TLS, NATS accounts, JWT authentication, leaf nodes, gateways, WebSocket, and MQTT). settings.cluster is allowed only when clustered is true, and rejects name, port, listen, host, net, routes, authorization, and tls. settings.jetstream is allowed only when jetstream.enabled is true, and rejects store_dir, enabled, and encryption settings (key, prev_key, cipher, and tpm).

  • Type: attribute set of anything

  • Default: { }

  • Example:

    {
    jetstream = {
    max_memory_store = 1073741824;
    };
    max_payload = 8388608;
    }

Size of each pod’s /data PersistentVolumeClaim when JetStream is enabled. Also sets the default settings.jetstream.max_file_store. Kubernetes cannot resize a StatefulSet’s volumeClaimTemplates in place, so changing storage.size does not resize existing PersistentVolumeClaims.

  • Type: Kubernetes quantity, such as "500m" or "1Gi" (a non-negative decimal or integer with an optional suffix m, k, M, G, T, P, E, Ki, Mi, Gi, Ti, Pi or Ei)
  • Default: "10Gi"

StorageClass for each pod’s JetStream volume. When null, Kix uses the cluster’s storageClasses provider if configured, or falls back to the cluster’s default StorageClass.

  • Type: null or string
  • Default: null