<p>my problem is that I need to increase NATS max_payload in production environment but it uses Kubernetes and I have no idea how to do that, I tried to use ConfigMap but I had not success.</p>
<p>In local/dev environment it uses a NATS config file with docker so it works fine.</p>
<p>Way to make it works local: <a href="https://stackoverflow.com/questions/65638631/nats-with-moleculer-how-can-i-change-nats-max-payload-value">NATS with moleculer. How can I change NATS max_payload value?</a></p>
<p>Code inside k8s/deployment.develop.yaml</p>
<pre><code>(...)
apiVersion: v1
kind: ServiceAccount
metadata:
  name: nats
  namespace: develop
  labels:
    account: nats
---
apiVersion: v1
kind: Service
metadata:
  name: nats
  namespace: develop
  labels:
    app: nats
    service: nats
spec:
  ports:
    - port: 4222
      targetPort: 4222
  selector:
    app: nats
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: nats-v1
  namespace: develop
  labels:
    app: nats
    version: v1
spec:
  replicas: 1
  strategy: {}
  selector:
    matchLabels:
      app: nats
      version: v1
  template:
    metadata:
      labels:
        app: nats
        version: v1
    spec:
      serviceAccountName: nats
      containers:
        - image: 'nats:alpine'
          name: nats
          ports:
            - containerPort: 4222
      restartPolicy: Always
      tolerations: []
      affinity: {}
</code></pre>
<p>Thanks!</p>

Matheus Chignolli
<p>I would recommend using these <a href="https://github.com/nats-io/k8s/tree/master/helm/charts/nats#limits" rel="nofollow noreferrer">NATS Helm charts</a> and then use something like the following:</p>
<pre class="lang-yaml prettyprint-override"><code>nats:
  limits:
    maxPayload: &quot;5mb&quot;
</code></pre>
<p>You can find a full example here: <a href="https://github.com/nats-io/k8s/tree/master/helm/charts/nats#limits" rel="nofollow noreferrer">https://github.com/nats-io/k8s/tree/master/helm/charts/nats#limits</a></p>
