Skip to content

Commit

Permalink
updated readme and added kustomize base
Browse files Browse the repository at this point in the history
  • Loading branch information
asiyani committed Dec 2, 2022
1 parent 0f1fbca commit 6ff3d9e
Show file tree
Hide file tree
Showing 6 changed files with 91 additions and 21 deletions.
27 changes: 6 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,31 +1,16 @@
# kube-summary-exporter

[![Build Status](https://drone.prod.merit.uw.systems/api/badges/utilitywarehouse/kube-summary-exporter/status.svg)](https://drone.prod.merit.uw.systems/utilitywarehouse/kube-summary-exporter)

Exports prometheus metrics for the Kubernetes Summary API.

## Usage
## run locally

Visiting http://localhost:9779/node/example-node will return metrics for the
node 'example-node'.
To run exporter locally run `go run ./...`

Here's an example scrape config. This assumes that the exporter is available at `kube-summary-exporter:9779`.
This will run server on default port `9779`

```
- job_name: "kubernetes-summary"
kubernetes_sd_configs:
- role: node
relabel_configs:
- action: labelmap
regex: __meta_kubernetes_node_label_(.+)
- source_labels: [__meta_kubernetes_node_name]
regex: (.+)
target_label: __metrics_path__
replacement: /node/${1}
- target_label: __address__
replacement: kube-summary-exporter:9779
```
Visiting http://localhost:9779/node/example-node will return metrics for the
node 'example-node'. App will look for `example-node` in the `current-context` cluster set in kube config.

[Here's an example scrape config.](manifests/scrap-config.yaml)
## Metrics

| Metric | Description | Labels |
Expand Down
42 changes: 42 additions & 0 deletions manifests/base/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: kube-summary-exporter
---
apiVersion: v1
kind: Service
metadata:
labels:
name: kube-summary-exporter
name: kube-summary-exporter
spec:
ports:
- name: kube-summary-exporter
protocol: TCP
port: 9779
targetPort: 9779
selector:
app: kube-summary-exporter
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: kube-summary-exporter
spec:
replicas: 1
selector:
matchLabels:
app: kube-summary-exporter
template:
metadata:
name: kube-summary-exporter
labels:
app: kube-summary-exporter
spec:
serviceAccountName: kube-summary-exporter
containers:
- name: kube-summary-exporter
image: quay.io/utilitywarehouse/kube-summary-exporter:latest
ports:
- name: tcp
containerPort: 9779
4 changes: 4 additions & 0 deletions manifests/base/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- deployment.yaml
21 changes: 21 additions & 0 deletions manifests/cluster/clusterrole.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: kube-summary-exporter
rules:
- apiGroups: [""]
resources: ["nodes/proxy"]
verbs: ["get"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: kube-summary-exporter
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: kube-summary-exporter
subjects:
- kind: ServiceAccount
name: kube-summary-exporter
namespace: sys-prom
4 changes: 4 additions & 0 deletions manifests/cluster/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- clusterrole.yaml
14 changes: 14 additions & 0 deletions manifests/scrap-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Scrape config for the Summary API exporter.
# This assumes that the exporter is available at kube-summary-exporter:9779
- job_name: "kubernetes-summary"
kubernetes_sd_configs:
- role: node
relabel_configs:
- action: labelmap
regex: __meta_kubernetes_node_label_(.+)
- source_labels: [__meta_kubernetes_node_name]
regex: (.+)
target_label: __metrics_path__
replacement: /node/${1}
- target_label: __address__
replacement: kube-summary-exporter:9779

0 comments on commit 6ff3d9e

Please sign in to comment.