Skip to content

Commit 36a7060

Browse files
authored
fix: prometheus configMap issue for k3s (#12)
* Add default namespace * fix prometheus configmap for k3s * Add comment to k3s configmap
1 parent e23365f commit 36a7060

File tree

8 files changed

+278
-6
lines changed

8 files changed

+278
-6
lines changed

base/monitoring/prometheus/rbac/prometheus.ConfigMap.yaml

Lines changed: 262 additions & 1 deletion
Large diffs are not rendered by default.

components/clusters/k3s/monitoring/patches/prometheus.ConfigMap.yaml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
apiVersion: v1
22
kind: ConfigMap
33
metadata:
4-
name: prometheus
4+
name: prometheus-rbac
55
data:
66
prometheus.yml: |
77
global:
@@ -28,6 +28,7 @@ data:
2828
- source_labels: [__meta_kubernetes_namespace, __meta_kubernetes_service_name, __meta_kubernetes_endpoint_port_name, __meta_kubernetes_pod_node_name]
2929
action: keep
3030
regex: default;kubernetes;https
31+
3132
- job_name: 'kubernetes-nodes'
3233
scheme: https
3334
tls_config:
@@ -65,8 +66,9 @@ data:
6566
regex: (.+)
6667
action: replace
6768
target_label: container_label_io_kubernetes_pod_name
69+
6870
############################################################################################################
69-
71+
7072
- job_name: 'kubernetes-service-endpoints'
7173
kubernetes_sd_configs:
7274
- role: endpoints
@@ -126,6 +128,7 @@ data:
126128
target_label: ns
127129
- source_labels: [__meta_kubernetes_service_name]
128130
target_label: kubernetes_name
131+
129132
- job_name: 'kubernetes-pods'
130133
kubernetes_sd_configs:
131134
- role: pod
@@ -156,12 +159,13 @@ data:
156159
target_label: ns
157160
metric_relabel_configs:
158161
- source_labels: [kubernetes_io_hostname]
159-
regex: sourcegraph-0
162+
regex: sourcegraph-0 # ACTION: replace 'sourcegraph-0' with your node name
160163
action: keep
161164
- source_labels: [namespace]
162-
regex: default
165+
regex: default # ACTION: replace 'default' with your namespace
163166
action: keep
164167
############################################################################################################
168+
165169
# Scrape prometheus itself for metrics.
166170
- job_name: 'builtin-prometheus'
167171
static_configs:
@@ -173,4 +177,4 @@ data:
173177
static_configs:
174178
- targets: ['127.0.0.1:9093']
175179
labels:
176-
app: alertmanager
180+
app: alertmanager

examples/k3s/kustomization.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
# Includes RBAC resources
22
apiVersion: kustomize.config.k8s.io/v1beta1
33
kind: Kustomization
4+
namespace: ns-sourcegraph
45
resources:
56
# Sourcegraph Main Stack
67
- ../../base/sourcegraph
78
components:
9+
- ../../components/resources/namespace
810
# Use resources for a size-XS instance
911
- ../../components/sizes/xs
1012
# This configures the Sourcegraph instance and networking to work in a k3s cluster

examples/k3s/l/kustomization.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Includes RBAC resources
22
apiVersion: kustomize.config.k8s.io/v1beta1
33
kind: Kustomization
4+
namespace: default
45
resources:
56
# Sourcegraph Main Stack
67
- ../../../base/sourcegraph

examples/k3s/m/kustomization.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Includes RBAC resources
22
apiVersion: kustomize.config.k8s.io/v1beta1
33
kind: Kustomization
4+
namespace: default
45
resources:
56
# Sourcegraph Main Stack
67
- ../../../base/sourcegraph

examples/k3s/s/kustomization.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Includes RBAC resources
22
apiVersion: kustomize.config.k8s.io/v1beta1
33
kind: Kustomization
4+
namespace: default
45
resources:
56
# Sourcegraph Main Stack
67
- ../../../base/sourcegraph

examples/k3s/xl/kustomization.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Includes RBAC resources
22
apiVersion: kustomize.config.k8s.io/v1beta1
33
kind: Kustomization
4+
namespace: default
45
resources:
56
# Sourcegraph Main Stack
67
- ../../../base/sourcegraph

examples/k3s/xs/kustomization.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Includes RBAC resources
22
apiVersion: kustomize.config.k8s.io/v1beta1
33
kind: Kustomization
4+
namespace: default
45
resources:
56
# Sourcegraph Main Stack
67
- ../../../base/sourcegraph

0 commit comments

Comments
 (0)