Skip to content

Commit

Permalink
chore: unmanaged fixes (#56)
Browse files Browse the repository at this point in the history
Signed-off-by: Evan Baker <rbtr@users.noreply.github.com>
Co-authored-by: Evan Baker <rbtr@users.noreply.github.com>
  • Loading branch information
matmerr and rbtr authored Mar 15, 2024
1 parent 7dd6cb3 commit 7866733
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 40 deletions.
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ helm-install: manifests
--set logLevel=info \
--set os.windows=true \
--set operator.enabled=false \
--set enabledPlugin_linux="[\"dropreason\"\,\"packetforward\"\,\"linuxutil\"\,\"dns\"]"
--set enabledPlugin_linux="\[dropreason\,packetforward\,linuxutil\,dns\]"

# advanced/pod-level mode with scale limitations, where metrics are aggregated by source and destination Pod
helm-install-advanced-remote-context: manifests
Expand All @@ -420,7 +420,7 @@ helm-install-advanced-remote-context: manifests
--set operator.enableRetinaEndpoint=true \
--set operator.repository=$(IMAGE_REGISTRY)/$(RETINA_OPERATOR_IMAGE) \
--skip-crds \
--set enabledPlugin_linux="[\"dropreason\",\"packetforward\",\"linuxutil\",\"dns\",\"packetparser\"\]" \
--set enabledPlugin_linux="\[dropreason\,packetforward\,linuxutil\,dns\,packetparser\]" \
--set enablePodLevel=true \
--set remoteContext=true

Expand All @@ -437,7 +437,7 @@ helm-install-advanced-local-context: manifests
--set operator.enableRetinaEndpoint=true \
--set operator.repository=$(IMAGE_REGISTRY)/$(RETINA_OPERATOR_IMAGE) \
--skip-crds \
--set enabledPlugin_linux="[\"dropreason\",\"packetforward\",\"linuxutil\",\"dns\",\"packetparser\"]" \
--set enabledPlugin_linux="\[dropreason\,packetforward\,linuxutil\,dns\,packetparser\]" \
--set enablePodLevel=true \
--set enableAnnotations=true \
--set bypassLookupIPOfInterest=false
Expand Down
45 changes: 45 additions & 0 deletions deploy/prometheus/values.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,50 @@
windowsMonitoring:
enabled: true

prometheusOperator:
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: kubernetes.io/os
operator: In
values:
- linux

admissionWebhooks:
deployment:
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: kubernetes.io/os
operator: In
values:
- linux
patch:
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: kubernetes.io/os
operator: In
values:
- linux

prometheus:
prometheusSpec:
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: kubernetes.io/os
operator: In
values:
- linux
additionalScrapeConfigs: |
- job_name: "retina-pods"
kubernetes_sd_configs:
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
55 changes: 18 additions & 37 deletions docs/installation/prometheus-unmanaged.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,52 +15,21 @@
helm repo update
```

2. Install the Prometheus chart
2. Save **[these Prometheus values](https://github.com/microsoft/retina/blob/main/deploy/prometheus/values.yaml)** below to `deploy/prometheus/values.yaml`

3. Install the Prometheus chart

```shell
helm install prometheus -n kube-system -f deploy/prometheus/values.yaml prometheus-community/kube-prometheus-stack
```

3. Save the Prometheus values below to `deploy/prometheus/values.yaml`

```yaml
prometheus:
prometheusSpec:
additionalScrapeConfigs: |
- job_name: "retina-pods"
kubernetes_sd_configs:
- role: pod
relabel_configs:
- source_labels: [__meta_kubernetes_pod_container_name]
action: keep
regex: retina(.*)
- source_labels:
[__address__, __meta_kubernetes_pod_annotation_prometheus_io_port]
separator: ":"
regex: ([^:]+)(?::\d+)?
target_label: __address__
replacement: ${1}:${2}
action: replace
- source_labels: [__meta_kubernetes_pod_node_name]
action: replace
target_label: instance
metric_relabel_configs:
- source_labels: [__name__]
action: keep
regex: (.*)
```
4. Upgrade deployment with
Or if you already have the chart installed, upgrade how you see fit, providing the new job name as an additional scrape config, ex:

```shell
helm upgrade prometheus -n kube-system -f deploy/prometheus/values.yaml prometheus-community/kube-prometheus-stack
```

5. Install Retina

```shell
helm install retina ./deploy/manifests/controller/helm/retina/ --namespace kube-system --dependency-update
```
Node: Grafana and kube-state metrics may schedule on Windows nodes, the current chart doesn't have node affinity for those components. Some manual intervention may be required.

6. Verify that the Retina Pods are being scraped by port-forwarding the Prometheus server:

Expand All @@ -74,4 +43,16 @@

## Configuring Grafana

Create a Grafana instance at [grafana.com](https://www.grafana.com) and follow [Configuring Grafana](./grafana.md).
Create a Grafana instance at [grafana.com](https://www.grafana.com) and follow [Configuring Grafana](./grafana.md), or use the one installed from above.

8. Get the Grafana password:

```shell
kubectl get secret -n kube-system prometheus-grafana -o jsonpath="{.data.admin-password}" | base64 --decode ; echo
```

9. Import the new dashboard from **[here](https://grafana.com/grafana/dashboards/18814/)**.

10. Metrics should be visible:

![alt text](img/grafana-dashboard-metrics.png)

0 comments on commit 7866733

Please sign in to comment.