-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This PR adds to features: * It allows us to centrally scrape the kluster metrics (apiserver, ccm, cm scheduler) into a dedicated prometheus with short retention * It exposes scheduler, cm, ccm metrics via an ingress so that users can start collecting cluster metrics themselves. The metrics of all components (except etcd) are protected by kubernetes RBAC, so a service account token with RBAC permissions for `/metrics` is required.
- Loading branch information
Showing
12 changed files
with
232 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
apiVersion: monitoring.coreos.com/v1 | ||
kind: PodMonitor | ||
metadata: | ||
labels: | ||
prometheus: {{ .Values.metrics.prometheus }} | ||
name: {{ include "master.fullname" . }} | ||
spec: | ||
jobLabel: {{ include "master.fullname" . }} | ||
namespaceSelector: | ||
matchNames: | ||
- {{ .Release.Namespace }} | ||
podMetricsEndpoints: | ||
- interval: 60s | ||
port: api | ||
relabelings: | ||
- action: labelmap | ||
regex: __meta_kubernetes_pod_label_(.+) | ||
scheme: https | ||
bearerTokenSecret: | ||
name: {{ include "master.fullname" . }}-secret | ||
key: serviceAccount | ||
tlsConfig: | ||
insecureSkipVerify: true | ||
scrapeTimeout: 10s | ||
- interval: 60s | ||
port: metrics | ||
relabelings: | ||
- action: drop | ||
regex: ^etcd$ | ||
sourceLabels: [__meta_kubernetes_pod_label_component] | ||
- action: labelmap | ||
regex: __meta_kubernetes_pod_label_(.+) | ||
scheme: https | ||
bearerTokenSecret: | ||
name: {{ include "master.fullname" . }}-secret | ||
key: serviceAccount | ||
tlsConfig: | ||
insecureSkipVerify: true | ||
scrapeTimeout: 10s | ||
selector: | ||
matchLabels: | ||
release: {{ include "master.fullname" . }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -173,3 +173,6 @@ csi: | |
memory: 100Mi | ||
|
||
audit: "" | ||
|
||
metrics: | ||
prometheusName: kubernikus-collector |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package migration | ||
|
||
import ( | ||
"fmt" | ||
|
||
v1 "github.com/sapcc/kubernikus/pkg/apis/kubernikus/v1" | ||
"github.com/sapcc/kubernikus/pkg/controller/config" | ||
"github.com/sapcc/kubernikus/pkg/controller/ground" | ||
) | ||
|
||
func SeedKubernikusServiceAccount(rawKluster []byte, current *v1.Kluster, clients config.Clients, factories config.Factories) (err error) { | ||
kubernetes, err := clients.Satellites.ClientFor(current) | ||
if err != nil { | ||
return err | ||
} | ||
if err := ground.SeedKubernikusServiceAccount(kubernetes); err != nil { | ||
return fmt.Errorf("Failed to seed kubernikus service account: %w", err) | ||
} | ||
if err := ground.UpdateServiceAccountTokenInSecret(current, clients.Kubernetes, kubernetes); err != nil { | ||
return fmt.Errorf("Failed to update sa token in cluster secret: %w", err) | ||
} | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters