Skip to content

[NATS] The cluster is inconsistent after a k3s restart #406

@babykart

Description

@babykart

The cluster bootstrap is done without problem.

--datastore-endpoint "nats://kine:xxxxxxxxxxxx@localhost:4222/?noEmbed&bucket=kine"

For example, I deploy ArgoCD and everything works perfectly.
After a restart of the k3s service, the cluster is inconsistent: missing CRD, configMap ... I deploy the application again: the objects (CRD, configMaps ...) seem to be present and yet the deployments cannot access to them.
The only way to return to a consistent state is to reset and bootstrap the cluster again.
I tested manually creating the kv and letting k3s do it but the only difference is the discard parameter (old vs new) which does not impact the behavior after restarting k3s.
No error in NATS.
Obviously I'm using the latest stable version of NATS (2.10.25) with jetstram:

nats --context=sys server info
Server information for nikita (ND2VWGKBNHQHNOOEJ3E56D2DYJUJPT2HAM6JGCSINT6Q6POMZM5SCJ4H)

Process Details:

                     Version: 2.10.25
                  Git Commit: 006039e
                  Go Version: go1.23.5
                  Start Time: 2025-01-27 11:10:42
            Config Load Time: 2025-01-27 11:10:42
                      Uptime: 1h51m7s

Connection Details:

               Auth Required: true
                TLS Required: false
                        Host: 0.0.0.0:4222

JetStream:

                      Domain:
           Storage Directory: /var/lib/nats/jetstream
                  Max Memory: 1.0 GiB
                    Max File: 2.0 GiB
             Active Accounts: 1
               Memory In Use: 0 B
                 File In Use: 8.9 MiB
                API Requests: 490
                  API Errors: 1
  Always sync writes to disk: false
        Write sync Frequency: 2m0s

Limits:

                    Max Conn: 65,536
                    Max Subs: 0
                 Max Payload: 1.0 MiB
                 TLS Timeout: 2.00s
              Write Deadline: 10.00s

Statistics:

                   CPU Cores: 4 29.00%
                      Memory: 110 MiB
                 Connections: 2
               Subscriptions: 353
                    Messages: 150,316 in 3,411,786 out
                       Bytes: 37 MiB in 3.2 GiB out
              Slow Consumers: 0
nats kv info kine
Information for Key-Value Store Bucket kine created 2025-01-27T11:24:11+01:00

Configuration:

          Bucket Name: kine
         History Kept: 10
        Values Stored: 2,853
           Compressed: false
   Backing Store Kind: JetStream
          Description: Holds kine key/values
          Bucket Size: 8.9 MiB
  Maximum Bucket Size: unlimited
   Maximum Value Size: unlimited
          Maximum Age: unlimited
     JetStream Stream: KV_kine
              Storage: File

Cluster Information:

                 Name:
               Leader: nikita
nats str info KV_kine
Information for Stream KV_kine created 2025-01-27 11:24:11

           Description: Holds kine key/values
              Subjects: $KV.kine.>
              Replicas: 1
               Storage: File

Options:

             Retention: Limits
       Acknowledgments: true
        Discard Policy: Old
      Duplicate Window: 2m0s
            Direct Get: true
     Allows Msg Delete: false
          Allows Purge: true
        Allows Rollups: true

Limits:

      Maximum Messages: unlimited
   Maximum Per Subject: 10
         Maximum Bytes: unlimited
           Maximum Age: unlimited
  Maximum Message Size: unlimited
     Maximum Consumers: unlimited

State:

              Messages: 2,853
                 Bytes: 8.9 MiB
        First Sequence: 1 @ 2025-01-27 11:24:11
         Last Sequence: 31,939 @ 2025-01-27 12:53:33
      Deleted Messages: 29,086
      Active Consumers: 96
    Number of Subjects: 1,207

Reproductible with k3s-v1.3{0,1} and k0s-v1.31.
Let me know if you need more information.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions