Skip to content

Kubernetes - History Lost on Restart #4793

@cfis

Description

@cfis

Prerequisites

Describe the bug
When running rspamd on kubernetes, every time its pod it is restarted history "appears" to be lost although it is stored in a separate Redis container. This is because rspamd incorporates the hostname into the history key. For example one run might be rs_historydocker-mailserver-59cc9899d4-xmmgd_zst while the next could be rs_historydocker-mailserver-677cb6cd79-4xn48_zst.

The history is not actually lost, it is still in Redis, but the key has been orphaned since rspamd loses track of it.

Note this happens in docker too, see Mailu/Mailu#1837.

Any chance this could be changed? Unlike docker, Kubernetes does not let you specify the host name. So some ideas:

  • Don't use hostname in the key
  • Add an ENV variable like RSPAMD_HISTORY_HOSTNAME that can be optionally set or RSPAMD_HISTORY_KEY
  • Query redis for an existing key and reuse it
  • Etc.

Steps to Reproduce

  1. Deploy rspamd in Kubernetes. Get an email, look at the history in the UI
  2. Restart the pod
  3. Go back to the UI, there will no longer by any records under the history tab

Expected behavior
History is not lost since it still actually exists in a redis instance running in the cluster

Versions

rspamd --version
Rspamd daemon version 3.7.5

k0s version
v1.28.5+k0s.0

Container OS is:
FROM docker.io/debian:12-slim AS stage-base

Host is:
cat /etc/redhat-release
Fedora release 39 (Thirty Nine)

Host CPU:
13th Gen Intel(R) Core(TM) i9-13900T

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions