Compare commits
6 Commits
d98959bf86
...
main
Author | SHA1 | Date | |
---|---|---|---|
8f56c8b174
|
|||
b087336749
|
|||
9106f3bd8b
|
|||
fb8942479f
|
|||
5b5c4e4064
|
|||
da6ead588b
|
@@ -4,11 +4,29 @@ alloy:
|
|||||||
content: |-
|
content: |-
|
||||||
loki.write "default" {
|
loki.write "default" {
|
||||||
endpoint {
|
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"
|
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.
|
// 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.
|
// It watches cluster state and ensures targets are continually synced with what is currently running in your cluster.
|
||||||
discovery.kubernetes "pod" {
|
discovery.kubernetes "pod" {
|
||||||
@@ -95,3 +113,31 @@ alloy:
|
|||||||
|
|
||||||
forward_to = [loki.write.default.receiver]
|
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",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@@ -10,13 +10,10 @@ spec:
|
|||||||
elements:
|
elements:
|
||||||
- cluster: production
|
- cluster: production
|
||||||
url: https://kubernetes.default.svc
|
url: https://kubernetes.default.svc
|
||||||
chart: 4.11.7
|
|
||||||
- cluster: staging
|
- cluster: staging
|
||||||
url: https://k3s-ctrl-lb.lab.kill0.net:6443
|
url: https://k3s-ctrl-lb.lab.kill0.net:6443
|
||||||
chart: 4.11.7
|
|
||||||
- cluster: development
|
- cluster: development
|
||||||
url: https://k0s-ctrl-vip.lab.kill0.net:6443
|
url: https://k0s-ctrl-vip.lab.kill0.net:6443
|
||||||
chart: 4.11.7
|
|
||||||
template:
|
template:
|
||||||
metadata:
|
metadata:
|
||||||
name: 'kube-prometheus-stack-{{.cluster}}'
|
name: 'kube-prometheus-stack-{{.cluster}}'
|
||||||
@@ -41,3 +38,4 @@ spec:
|
|||||||
selfHeal: true
|
selfHeal: true
|
||||||
syncOptions:
|
syncOptions:
|
||||||
- CreateNamespace=true
|
- CreateNamespace=true
|
||||||
|
- ServerSideApply=true
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
grafana:
|
kube-prometheus-stack:
|
||||||
grafana:
|
grafana:
|
||||||
service:
|
service:
|
||||||
type: LoadBalancer
|
type: LoadBalancer
|
||||||
|
@@ -6,3 +6,4 @@ metadata:
|
|||||||
namespace: kubernaut
|
namespace: kubernaut
|
||||||
data:
|
data:
|
||||||
KUBERNAUT_CAT: kilwin
|
KUBERNAUT_CAT: kilwin
|
||||||
|
WEB_CONCURRENCY: "4"
|
||||||
|
@@ -51,10 +51,3 @@ spec:
|
|||||||
port: 4567
|
port: 4567
|
||||||
initialDelaySeconds: 5
|
initialDelaySeconds: 5
|
||||||
periodSeconds: 5
|
periodSeconds: 5
|
||||||
resources:
|
|
||||||
requests:
|
|
||||||
memory: 64Mi
|
|
||||||
cpu: 100m
|
|
||||||
limits:
|
|
||||||
memory: 128Mi
|
|
||||||
cpu: 200m
|
|
||||||
|
Reference in New Issue
Block a user