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.
| Stability | Experimental |
package value | packages.experimental.nats |
| Default software version | 2.15.3 |
| Default aliases | nats |
Dependencies
Section titled “Dependencies”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.
| Dependency | Requirement |
|---|---|
natsAuth | Required |
prometheus | Optional |
storageClasses | Optional |
Options
Section titled “Options”clustered
Section titled “clustered”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:
{ }
healthCheck.enabled
Section titled “healthCheck.enabled”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
healthCheck.retryFor
Section titled “healthCheck.retryFor”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:
1{2digest = "sha256:558394a23dd3c36f2d3a64b51865fd09908010e80a542cea5e75c2af543ed62a";3pullPolicy = "IfNotPresent";4repository = "docker.io/library/nats";5tag = "2.15.3-alpine";6}
image.digest
Section titled “image.digest”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
tagis the package’s tag, otherwise null
image.note
Section titled “image.note”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
image.promotedBy
Section titled “image.promotedBy”Who resolved this pin, for the record. Null when unknown.
- Type:
null or string - Default:
null
image.pullPolicy
Section titled “image.pullPolicy”imagePullPolicy for containers using this image. Null leaves it to Kubernetes.
- Type:
null or string - Default:
"IfNotPresent"
image.repository
Section titled “image.repository”Image repository, registry host included.
- Type:
string - Default:
"docker.io/library/nats"
image.resolvedAt
Section titled “image.resolvedAt”When this pin was resolved, RFC 3339. Null when unknown.
- Type:
null or string - Default:
null
image.sourceRev
Section titled “image.sourceRev”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
Section titled “image.tag”Image tag. What was asked for.
- Type:
string - Default:
"2.15.3-alpine"
jetstream.enabled
Section titled “jetstream.enabled”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
metrics.enabled
Section titled “metrics.enabled”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
metrics.image
Section titled “metrics.image”Container image for the prometheus-nats-exporter sidecar.
-
Type:
submodule -
Default:
1{2digest = "sha256:4b8ddc1c86fec360b5cd3d5e1fbc6fb52bdafd5805bba3901cc52926538af255";3pullPolicy = "IfNotPresent";4repository = "docker.io/natsio/prometheus-nats-exporter";5tag = "0.20.3";6}
metrics.image.digest
Section titled “metrics.image.digest”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
tagis the package’s tag, otherwise null
metrics.image.note
Section titled “metrics.image.note”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
metrics.image.promotedBy
Section titled “metrics.image.promotedBy”Who resolved this pin, for the record. Null when unknown.
- Type:
null or string - Default:
null
metrics.image.pullPolicy
Section titled “metrics.image.pullPolicy”imagePullPolicy for containers using this image. Null leaves it to Kubernetes.
- Type:
null or string - Default:
"IfNotPresent"
metrics.image.repository
Section titled “metrics.image.repository”Image repository, registry host included.
- Type:
string - Default:
"docker.io/natsio/prometheus-nats-exporter"
metrics.image.resolvedAt
Section titled “metrics.image.resolvedAt”When this pin was resolved, RFC 3339. Null when unknown.
- Type:
null or string - Default:
null
metrics.image.sourceRev
Section titled “metrics.image.sourceRev”Revision of the source the image was built from, when Kix built it. Null for upstream images.
- Type:
null or string - Default:
null
metrics.image.tag
Section titled “metrics.image.tag”Image tag. What was asked for.
- Type:
string - Default:
"0.20.3"
metrics.interval
Section titled “metrics.interval”Scrape interval (e.g. ”30s”). Null = use Prometheus default.
- Type:
null or string - Default:
null
metrics.resources
Section titled “metrics.resources”Container resource requests and limits. Each field keeps its default until set, and null removes a default.
-
Type:
submodule -
Default:
1{2limits = {3cpu = "500m";4memory = "128Mi";5};6requests = {7cpu = "50m";8memory = "64Mi";9};10}
metrics.resources.claims
Section titled “metrics.resources.claims”Dynamic resource claims the container uses. Null leaves it unset.
- Type:
null or (list of (submodule)) - Default:
null
metrics.resources.claims.*.name
Section titled “metrics.resources.claims.*.name”Name of an entry in the pod’s resourceClaims.
- Type:
string
metrics.resources.claims.*.request
Section titled “metrics.resources.claims.*.request”Request within the claim to use. Null uses the whole claim.
- Type:
null or string - Default:
null
metrics.resources.limits
Section titled “metrics.resources.limits”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:
{ }
metrics.resources.limits.cpu
Section titled “metrics.resources.limits.cpu”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
metrics.resources.limits.memory
Section titled “metrics.resources.limits.memory”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"
metrics.resources.requests
Section titled “metrics.resources.requests”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:
{ }
metrics.resources.requests.cpu
Section titled “metrics.resources.requests.cpu”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
metrics.resources.requests.memory
Section titled “metrics.resources.requests.memory”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"
replicas
Section titled “replicas”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:
3whenclusteredistrue, otherwise1
resources
Section titled “resources”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:
1{2limits = {3cpu = "500m";4memory = "1Gi";5};6requests = {7cpu = "500m";8memory = "1Gi";9};10}
resources.claims
Section titled “resources.claims”Dynamic resource claims the container uses. Null leaves it unset.
- Type:
null or (list of (submodule)) - Default:
null
resources.claims.*.name
Section titled “resources.claims.*.name”Name of an entry in the pod’s resourceClaims.
- Type:
string
resources.claims.*.request
Section titled “resources.claims.*.request”Request within the claim to use. Null uses the whole claim.
- Type:
null or string - Default:
null
resources.limits
Section titled “resources.limits”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:
{ }
resources.limits.cpu
Section titled “resources.limits.cpu”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"
resources.limits.ephemeral-storage
Section titled “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
resources.limits.memory
Section titled “resources.limits.memory”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"
resources.requests
Section titled “resources.requests”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:
{ }
resources.requests.cpu
Section titled “resources.requests.cpu”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"
resources.requests.ephemeral-storage
Section titled “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
resources.requests.memory
Section titled “resources.requests.memory”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"
settings
Section titled “settings”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:
1{2jetstream = {3max_memory_store = 1073741824;4};5max_payload = 8388608;6}
storage.size
Section titled “storage.size”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"
storage.storageClassName
Section titled “storage.storageClassName”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