Hi all, I am currently running an Alloy, Loki, and Grafana stack within one of my RKE2 clusters, and I want to expose Loki to services outside the cluster so that I can send logs to it. I plan on setting up alloy on future Windows and Linux VMs and I want them to be able to communicate with my current infrastructure. Does anyone have any knowledge on how to expose Loki? I tried kubectl expose on the loki-gateway service, but I haven’t had any luck.
This sounds like an infrastructure question. Personally I’d recommend you to keep your entire Loki cluster internal, and use some sort of application load balancer or nginx setup on the edge with public IPs (and proper certificate of course).
Hi all, so it turns out that Loki has built in ingress support, so you can expose Loki using that. Here is the basic template for formatting the values.yaml:
gateway:
enabled: true
ingress:
# -- Specifies whether an ingress for the gateway should be created
enabled: true
# -- Ingress Class Name. MAY be required for Kubernetes versions >= 1.18
ingressClassName: ""
# -- Annotations for the gateway ingress
annotations: {}
# -- Labels for the gateway ingress
labels: {}
# -- Hosts configuration for the gateway ingress, passed through the `tpl` function to allow templating
hosts:
- host: <HOSTNAME>
paths:
- path: /
pathType: ImplementationSpecific
# -- pathType (e.g. ImplementationSpecific, Prefix, .. etc.) might also be required by some Ingress Controllers
# pathType: Prefix
# -- TLS configuration for the gateway ingress. Hosts passed through the `tpl` function to allow templating
tls:
- secretName: loki-gateway-tls
hosts:
- <HOSTNAME>