-
Notifications
You must be signed in to change notification settings - Fork 800
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
eks-prow-build-cluster: create simple monitoring stack #5011
Merged
k8s-ci-robot
merged 9 commits into
kubernetes:main
from
pkprzekwas:basic-eks-monitoring
Mar 27, 2023
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
c93edaa
Create simple monitoring stack for EKS prow cluster
pkprzekwas 7c77904
Run yaml formatter
pkprzekwas d24bdb0
Increase resources for Prometheus, add disk resize readme
pkprzekwas 29e885f
Update node termination handler readme
pkprzekwas 6e870aa
cAdvisor: remove cluster role/role-binding for PSP, remove docker mou…
pkprzekwas 4cf7143
Remove PSP cluster role and binding for node-exporter
pkprzekwas ab9aff2
Change node-exporter registry to quay and bump version to 1.5.0
pkprzekwas 5259fb0
Update grafana config.ini
pkprzekwas 0ea2777
Remove commented IRSA annotations for prometheus SA
pkprzekwas File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
51 changes: 51 additions & 0 deletions
51
infra/aws/terraform/prow-build-cluster/resources/monitoring/README.md
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,51 @@ | ||
# EKS monitoring | ||
|
||
## Setting up monitoring | ||
|
||
```bash | ||
# Create monitoring namespace: | ||
kubectl apply -f ../namespaces.yaml | ||
|
||
# Install CRDs for Prometheus Operator: | ||
# (server side is required due to long annotations) | ||
kubectl apply --server-side -f ./prometheus-operator-crds | ||
|
||
# Install Prometheus Operator: | ||
kubectl apply -f ./prometheus-operator | ||
|
||
# Install kube-state-metrics | ||
kubectl apply -f ./kube-state-metrics | ||
|
||
# Install node-exporter | ||
kubectl apply -f ./node-exporter | ||
|
||
# Install cadvisor | ||
kubectl apply -f ./cadvisor | ||
|
||
# Install dashboards for Grafana | ||
kubectl apply --server-side -f ./grafana/dashboards | ||
|
||
# Install Grafana | ||
kubectl apply -f ./grafana | ||
``` | ||
|
||
[Prometheus Operator CRDs](https://github.com/prometheus-operator/prometheus-operator/tree/v0.63.0/example/prometheus-operator-crd-full) | ||
|
||
## Local access | ||
|
||
```bash | ||
# Prometheus | ||
kubectl --namespace monitoring port-forward svc/prometheus-operated 9090 | ||
|
||
# Grafana | ||
kubectl --namespace monitoring port-forward svc/grafana 3000 | ||
``` | ||
|
||
## Debugging | ||
|
||
- [Troubleshooting Prometheus Operator](https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/troubleshooting.md) | ||
|
||
Checking Prometheus configuration: | ||
``` | ||
kubectl -n monitoring get secret prometheus-main -ojson | jq -r '.data["prometheus.yaml.gz"]' | base64 -d | gunzip | less | ||
``` |
57 changes: 57 additions & 0 deletions
57
infra/aws/terraform/prow-build-cluster/resources/monitoring/cadvisor/ds.yaml
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,57 @@ | ||
apiVersion: apps/v1 | ||
kind: DaemonSet | ||
metadata: | ||
name: cadvisor | ||
namespace: monitoring | ||
spec: | ||
selector: | ||
matchLabels: | ||
name: cadvisor | ||
template: | ||
metadata: | ||
labels: | ||
name: cadvisor | ||
spec: | ||
serviceAccountName: cadvisor | ||
containers: | ||
- name: cadvisor | ||
image: gcr.io/cadvisor/cadvisor:v0.45.0 | ||
resources: | ||
requests: | ||
memory: 400Mi | ||
cpu: 400m | ||
limits: | ||
memory: 2000Mi | ||
cpu: 800m | ||
volumeMounts: | ||
- name: rootfs | ||
mountPath: /rootfs | ||
readOnly: true | ||
- name: var-run | ||
mountPath: /var/run | ||
readOnly: true | ||
- name: sys | ||
mountPath: /sys | ||
readOnly: true | ||
- name: disk | ||
mountPath: /dev/disk | ||
readOnly: true | ||
ports: | ||
- name: http | ||
containerPort: 8080 | ||
protocol: TCP | ||
automountServiceAccountToken: false | ||
terminationGracePeriodSeconds: 30 | ||
volumes: | ||
- name: rootfs | ||
hostPath: | ||
path: / | ||
- name: var-run | ||
hostPath: | ||
path: /var/run | ||
- name: sys | ||
hostPath: | ||
path: /sys | ||
- name: disk | ||
hostPath: | ||
path: /dev/disk |
5 changes: 5 additions & 0 deletions
5
infra/aws/terraform/prow-build-cluster/resources/monitoring/cadvisor/sa.yaml
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,5 @@ | ||
apiVersion: v1 | ||
kind: ServiceAccount | ||
metadata: | ||
name: cadvisor | ||
namespace: monitoring |
14 changes: 14 additions & 0 deletions
14
infra/aws/terraform/prow-build-cluster/resources/monitoring/cadvisor/service-monitor.yaml
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,14 @@ | ||
apiVersion: monitoring.coreos.com/v1 | ||
kind: ServiceMonitor | ||
metadata: | ||
name: cadvisor | ||
namespace: monitoring | ||
labels: | ||
prometheus: main | ||
spec: | ||
selector: | ||
matchLabels: | ||
name: cadvisor | ||
endpoints: | ||
- port: http | ||
honorLabels: true |
15 changes: 15 additions & 0 deletions
15
infra/aws/terraform/prow-build-cluster/resources/monitoring/cadvisor/service.yaml
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,15 @@ | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: cadvisor | ||
namespace: monitoring | ||
labels: | ||
name: cadvisor | ||
spec: | ||
type: ClusterIP | ||
ports: | ||
- port: 8080 | ||
protocol: TCP | ||
name: http | ||
selector: | ||
name: cadvisor |
39 changes: 39 additions & 0 deletions
39
infra/aws/terraform/prow-build-cluster/resources/monitoring/grafana/config.yaml
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,39 @@ | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
namespace: monitoring | ||
name: grafana | ||
data: | ||
grafana.ini: |- | ||
pkprzekwas marked this conversation as resolved.
Show resolved
Hide resolved
|
||
[analytics] | ||
reporting_enabled = false | ||
check_for_updates = true | ||
|
||
[log] | ||
mode = console | ||
|
||
[auth.basic] | ||
enabled = false | ||
|
||
[auth.anonymous] | ||
enabled = true | ||
org_role = Viewer | ||
|
||
[auth] | ||
disable_login_form = true | ||
|
||
[paths] | ||
data = /var/lib/grafana/data | ||
logs = /var/log/grafana | ||
plugins = /var/lib/grafana/plugins | ||
provisioning = /etc/grafana/provisioning | ||
|
||
[server] | ||
http_port = 3001 | ||
|
||
[security] | ||
disable_gravatar = true | ||
|
||
[metrics] | ||
enabled = true | ||
disable_total_stats = false |
17 changes: 17 additions & 0 deletions
17
infra/aws/terraform/prow-build-cluster/resources/monitoring/grafana/dashboards.yaml
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,17 @@ | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
namespace: monitoring | ||
name: dashboards | ||
data: | ||
dashboardproviders.yaml: |- | ||
apiVersion: 1 | ||
providers: | ||
- disableDeletion: false | ||
editable: false | ||
folder: Kubernetes | ||
name: kubernetes | ||
options: | ||
path: /var/lib/grafana/dashboards/kubernetes | ||
orgId: 1 | ||
type: file |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we expose this Grafana instance publicly? If yes, let's create a follow up issue to track that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wasn't sure if this is something that we want to maintain in a longer term. IMO we can expose it for now till we haven't figured which monitoring solution works the best for both GCP and AWS clusters.
I wonder if there were other things we want to expose over time, in which case ingress-controller would be handy.