Alloy on k8s: How to receive syslog from remote servers

Overview

I’m planning to deploy alloy on my kubrentes cluster by helm.

And I want to make Alloy able to receive syslog from remote servers. Remote servers are out of the kubernetes cluster.

But I can’t find the knowledge about this.

My understanding

syslog listner configuration is this:

In my understanding, I should write above configurations as alloy.configMap.content in values.yaml when I deploy Alloy on k8s by helm.

e.g.

alloy:
  configMap:
    content: |-
      loki.source.syslog "remote" {
        listener {
          address  = "0.0.0.0:515"
          protocol     = "tcp"
          max_message_length = 0
          idle_timeout = "0s"
          labels   = { component = "loki.source.syslog", protocol = "tcp" }
        }
        listener {
          address  = "0.0.0.0:514"
          protocol     = "udp"
          max_message_length = 0
          idle_timeout = "0s"
          labels   = { component = "loki.source.syslog", protocol = "udp" }
        }
[...]

My Question

How can I expose syslog listener ports when I deploy Alloy on k8s by helm? I’d like to use NodePort.

By the way, I know how to expose 12345 port. But I don’t know about syslog listener ports.

e.g.

service:
  enabled: true
  type: NodePort
  nodePort: 31001

Your question is more related to Kubernetes than it is Alloy. You should research how to expose service endpoint from kubernetes. There are many ways to do this, and it depends on what your infrastructure is like.