Compare commits

...

6 Commits

5 changed files with 53 additions and 11 deletions

View File

@@ -4,11 +4,29 @@ alloy:
content: |-
loki.write "default" {
endpoint {
url = "http://loki.loki.svc.cluster.local:3100/loki/api/v1/push"
url = "http://loki-gateway.loki.svc.cluster.local/loki/api/v1/push"
tenant_id = "luna"
}
}
// local.file_match discovers files on the local filesystem using glob patterns and the doublestar library. It returns an array of file paths.
local.file_match "node_logs" {
path_targets = [{
// Monitor syslog to scrape node-logs
__path__ = "/var/log/messages",
job = "node/syslog",
node_name = sys.env("HOSTNAME"),
cluster = "development",
}]
}
// loki.source.file reads log entries from files and forwards them to other loki.* components.
// You can specify multiple loki.source.file components by giving them different labels.
loki.source.file "node_logs" {
targets = local.file_match.node_logs.targets
forward_to = [loki.write.default.receiver]
}
// discovery.kubernetes allows you to find scrape targets from Kubernetes resources.
// It watches cluster state and ensures targets are continually synced with what is currently running in your cluster.
discovery.kubernetes "pod" {
@@ -95,3 +113,31 @@ alloy:
forward_to = [loki.write.default.receiver]
}
// loki.source.kubernetes_events tails events from the Kubernetes API and converts them
// into log lines to forward to other Loki components.
loki.source.kubernetes_events "cluster_events" {
job_name = "integrations/kubernetes/eventhandler"
log_format = "logfmt"
forward_to = [
loki.process.cluster_events.receiver,
]
}
// loki.process receives log entries from other loki components, applies one or more processing stages,
// and forwards the results to the list of receivers in the component's arguments.
loki.process "cluster_events" {
forward_to = [loki.write.default.receiver]
stage.static_labels {
values = {
cluster = "development",
}
}
stage.labels {
values = {
kubernetes_cluster_events = "job",
}
}
}

View File

@@ -10,13 +10,10 @@ spec:
elements:
- cluster: production
url: https://kubernetes.default.svc
chart: 4.11.7
- cluster: staging
url: https://k3s-ctrl-lb.lab.kill0.net:6443
chart: 4.11.7
- cluster: development
url: https://k0s-ctrl-vip.lab.kill0.net:6443
chart: 4.11.7
template:
metadata:
name: 'kube-prometheus-stack-{{.cluster}}'
@@ -41,3 +38,4 @@ spec:
selfHeal: true
syncOptions:
- CreateNamespace=true
- ServerSideApply=true

View File

@@ -0,0 +1,4 @@
kube-prometheus-stack:
grafana:
service:
type: LoadBalancer

View File

@@ -6,3 +6,4 @@ metadata:
namespace: kubernaut
data:
KUBERNAUT_CAT: kilwin
WEB_CONCURRENCY: "4"

View File

@@ -51,10 +51,3 @@ spec:
port: 4567
initialDelaySeconds: 5
periodSeconds: 5
resources:
requests:
memory: 64Mi
cpu: 100m
limits:
memory: 128Mi
cpu: 200m