loki: Use fetchcert to manage server certificate
Before going into production with Grafana Loki, I want to set it up to use TLS. To that end, I have configured _cert-manager_ to issue it a certificate, signed by _DCH CA_. In order to use said certificate, we need to configure `fetchcert` to run on the Loki server.master
parent
29afcae52e
commit
011058aec3
|
@ -27,3 +27,14 @@ fetchcert: base: f.#Fetchcert & {
|
||||||
kubernetes_url: "https://kubernetes.pyrocufflink.blue:6443"
|
kubernetes_url: "https://kubernetes.pyrocufflink.blue:6443"
|
||||||
namespace: "dch-ca"
|
namespace: "dch-ca"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fetchcert: loki: fetchcert.base & {
|
||||||
|
secret: "loki"
|
||||||
|
cert: "loki.cer"
|
||||||
|
key: "loki.key"
|
||||||
|
postupdate: """
|
||||||
|
install -v -o root -g 10001 -m ugo=r /etc/fetchcert/certs/loki.cer /etc/loki/server.cer
|
||||||
|
install -v -o root -g 10001 -m ug=r,o= /etc/fetchcert/certs/loki.key /etc/loki/server.key
|
||||||
|
systemctl reload loki
|
||||||
|
"""
|
||||||
|
}
|
||||||
|
|
|
@ -4,3 +4,33 @@ import (
|
||||||
|
|
||||||
ssh: prod.ssh
|
ssh: prod.ssh
|
||||||
sudo: prod.sudo
|
sudo: prod.sudo
|
||||||
|
|
||||||
|
fetchcert: prod.fetchcert.loki & {
|
||||||
|
token: """
|
||||||
|
-----BEGIN AGE ENCRYPTED FILE-----
|
||||||
|
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBtNTZzeW9XeWoycVdQa092
|
||||||
|
N0VYL2grR0lLY1c4QXl2VHI3NmsxM253UlNVCmZLbFZWakJGVG9WakkyYmpJL1VR
|
||||||
|
YmVQQXRCTlhrQk9UYUE5UkRFZUlwNlkKLS0tIGg4R25ZaVhUU1BFVjdac2NqMVpQ
|
||||||
|
QmZRTndBalZndVF0VFpxdHBRemhNS1EKrNZG179fh2aS/3FOaM1xCHRG4uOt5jyx
|
||||||
|
1m5h3Q9y2u7EbcbZHLIZR3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
||||||
|
EOpaSSc3wOmHpnB6qCyCJ45mb6HwRCGoZmxaG/5uWreys0R8AJsMIq8vFVAS3sDo
|
||||||
|
EONNYMWtlAZg8XOZcSgSnKpUF5VWlt+3HLkpwQkTBq3SvjvMd6shybPVGVNxMwbU
|
||||||
|
a2gey9Kv4lq8Suvvrn31DeYErGwUYy0qMwTL1a4Q8I08kMg6lqqaPotIC63RSlUu
|
||||||
|
SEoarQ==
|
||||||
|
-----END AGE ENCRYPTED FILE-----
|
||||||
|
"""
|
||||||
|
}
|
||||||
|
|
|
@ -1 +1,2 @@
|
||||||
. scripts/no-coreos-default-sudo.sh
|
. scripts/no-coreos-default-sudo.sh
|
||||||
|
. scripts/loki-cert.sh
|
||||||
|
|
|
@ -2,12 +2,14 @@ import (
|
||||||
"list"
|
"list"
|
||||||
|
|
||||||
"du5t1n.me/cfg/app/collectd"
|
"du5t1n.me/cfg/app/collectd"
|
||||||
|
"du5t1n.me/cfg/app/fetchcert"
|
||||||
"du5t1n.me/cfg/app/loki"
|
"du5t1n.me/cfg/app/loki"
|
||||||
"du5t1n.me/cfg/env/prod"
|
"du5t1n.me/cfg/env/prod"
|
||||||
)
|
)
|
||||||
|
|
||||||
render: list.Concat([
|
render: list.Concat([
|
||||||
collectd.templates,
|
|
||||||
loki.templates,
|
|
||||||
prod.templates,
|
prod.templates,
|
||||||
|
collectd.templates,
|
||||||
|
fetchcert.templates,
|
||||||
|
loki.templates,
|
||||||
])
|
])
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
if [ ! -f /host/etc/loki/server.cer ] || [ ! -f /host/etc/loki/server.key ]; then
|
||||||
|
systemctl start fetchcert
|
||||||
|
fi
|
|
@ -2,6 +2,9 @@ auth_enabled: false
|
||||||
|
|
||||||
server:
|
server:
|
||||||
http_listen_port: 3100
|
http_listen_port: 3100
|
||||||
|
http_tls_config:
|
||||||
|
cert_file: /etc/loki/server.cer
|
||||||
|
key_file: /etc/loki/server.key
|
||||||
grpc_listen_port: 9096
|
grpc_listen_port: 9096
|
||||||
|
|
||||||
common:
|
common:
|
||||||
|
|
Loading…
Reference in New Issue