Skip to content

Commit

Permalink
Add microk8s-kube-metrics (#8)
Browse files Browse the repository at this point in the history
Add microk8s-kube-metrics (#8)
  • Loading branch information
georgedriver authored Mar 25, 2022
1 parent ca81259 commit 61ad760
Show file tree
Hide file tree
Showing 9 changed files with 278 additions and 13 deletions.
26 changes: 13 additions & 13 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,25 @@ jobs:
- name: Checkout
uses: actions/checkout@v1
- name: Run chart-testing (lint)
uses: helm/chart-testing-action@master
uses: helm/chart-testing-action@v2.2.1
with:
command: lint
config: .github/ct.yaml

lint-docs:
runs-on: ubuntu-latest
needs: lint-chart
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Run helm-docs
run: .github/helm-docs.sh
# lint-docs:
# runs-on: ubuntu-latest
# needs: lint-chart
# steps:
# - name: Checkout
# uses: actions/checkout@v1
# - name: Run helm-docs
# run: .github/helm-docs.sh

kubeval-chart:
runs-on: ubuntu-latest
needs:
- lint-chart
- lint-docs
# - lint-docs
strategy:
matrix:
k8s:
Expand All @@ -49,7 +49,7 @@ jobs:
runs-on: ubuntu-latest
needs:
- lint-chart
- lint-docs
# - lint-docs
- kubeval-chart
strategy:
matrix:
Expand All @@ -60,11 +60,11 @@ jobs:
- name: Checkout
uses: actions/checkout@v1
- name: Create kind ${{ matrix.k8s }} cluster
uses: helm/kind-action@master
uses: helm/kind-action@v1.2.0
with:
node_image: kindest/node:${{ matrix.k8s }}
- name: Run chart-testing (install)
uses: helm/chart-testing-action@master
uses: helm/chart-testing-action@v2.2.1
with:
command: install
config: .github/ct.yaml
15 changes: 15 additions & 0 deletions charts/microk8s-kube-metrics/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: v1
appVersion: "1.0"
description: A Helm chart for Microk8s controller-manager, scheduler and kube-proxy metrics in Prometheus
name: microk8s-kube-metrics
type: application
version: 0.0.1
home: https://github.com/georgedriver/helm-charts
sources:
- https://github.com/georgedriver/helm-charts
keywords:
- microk8s
- prometheus
- metrics
maintainers:
- name: George
32 changes: 32 additions & 0 deletions charts/microk8s-kube-metrics/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# microk8s-kube-metrics

A Helm chart for Microk8s controller-manager, scheduler and kube-proxy metrics in Prometheus

## Source Code

* <https://github.com/georgedriver/helm-charts>

## Installation

### Add Helm repository

```shell
helm repo add georgedriver https://georgedriver.github.io/helm-charts
helm repo update
```

```shell
helm install --generate-name microk8s-kube-metrics
```

## Configuration

The following table lists the configurable parameters of the chart and the default values.

## Values

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| masterIP | string | `"test"` | |

`docker run --rm --volume "$(pwd):/helm-docs" -u $(id -u) jnorwood/helm-docs:latest`
27 changes: 27 additions & 0 deletions charts/microk8s-kube-metrics/README.md.gotmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{{ template "chart.header" . }}
{{ template "chart.description" . }}

{{ template "chart.kubeVersionLine" . }}

{{ template "chart.sourcesSection" . }}

## Installation

### Add Helm repository

```shell
helm repo add georgedriver https://georgedriver.github.io/helm-charts
helm repo update
```

```shell
helm install --generate-name {{ template "chart.name" . }}
```

## Configuration

The following table lists the configurable parameters of the chart and the default values.

{{ template "chart.valuesSection" . }}

`docker run --rm --volume "$(pwd):/helm-docs" -u $(id -u) jnorwood/helm-docs:latest`
Empty file.
64 changes: 64 additions & 0 deletions charts/microk8s-kube-metrics/templates/endpoint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
---
apiVersion: v1
kind: Endpoints
metadata:
labels:
app.kubernetes.io/managed-by: prometheus-operator
app.kubernetes.io/name: kube-controller-manager
k8s-app: kube-controller-manager
name: kube-controller-manager
namespace: kube-system
subsets:
- addresses:
- ip: {{ .Values.masterIP }}
targetRef:
kind: Node
name: norse
uid: a466371b-4c17-4306-aa64-91d533b7b0a5
ports:
- name: https-metrics
port: 10257
protocol: TCP
---
apiVersion: v1
kind: Endpoints
metadata:
labels:
app.kubernetes.io/managed-by: prometheus-operator
app.kubernetes.io/name: kube-scheduler
k8s-app: kube-scheduler
name: kube-scheduler
namespace: kube-system
subsets:
- addresses:
- ip: {{ .Values.masterIP }}
targetRef:
kind: Node
name: norse
uid: a466371b-4c17-4306-aa64-91d533b7b0a5
ports:
- name: https-metrics
port: 10259
protocol: TCP

---
apiVersion: v1
kind: Endpoints
metadata:
labels:
app.kubernetes.io/managed-by: prometheus-operator
app.kubernetes.io/name: kube-proxy
k8s-app: kube-proxy
name: kube-proxy
namespace: kube-system
subsets:
- addresses:
- ip: {{ .Values.masterIP }}
targetRef:
kind: Node
name: norse
uid: a466371b-4c17-4306-aa64-91d533b7b0a5
ports:
- name: http-metrics
port: 10249
protocol: TCP
71 changes: 71 additions & 0 deletions charts/microk8s-kube-metrics/templates/servicemonitor.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: microk8s-kube-proxy
namespace: system-monitoring
labels:
app.kubernetes.io/name: microk8s-kube-proxy
k8s-monitoring: "true"
spec:
jobLabel: kube-proxy
endpoints:
- bearerTokenFile: /var/run/secrets/kubernetes.io/serviceaccount/token
interval: 30s
port: http-metrics
scheme: http
selector:
matchLabels:
app.kubernetes.io/name: kube-proxy
namespaceSelector:
matchNames:
- kube-system

---
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: microk8s-kube-controller-manager
namespace: system-monitoring
labels:
app.kubernetes.io/name: microk8s-kube-controller-manager
k8s-monitoring: "true"
spec:
jobLabel: kube-controller-manager
endpoints:
- bearerTokenFile: /var/run/secrets/kubernetes.io/serviceaccount/token
interval: 30s
port: https-metrics
scheme: https
tlsConfig:
insecureSkipVerify: true
selector:
matchLabels:
app.kubernetes.io/name: kube-controller-manager
namespaceSelector:
matchNames:
- kube-system

---
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: microk8s-kube-scheduler
namespace: system-monitoring
labels:
app.kubernetes.io/name: microk8s-kube-scheduler
k8s-monitoring: "true"
spec:
jobLabel: kube-scheduler
endpoints:
- bearerTokenFile: /var/run/secrets/kubernetes.io/serviceaccount/token
interval: 30s
port: https-metrics
scheme: https
tlsConfig:
insecureSkipVerify: true
selector:
matchLabels:
app.kubernetes.io/name: kube-scheduler
namespaceSelector:
matchNames:
- kube-system
50 changes: 50 additions & 0 deletions charts/microk8s-kube-metrics/templates/svc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
apiVersion: v1
kind: Service
metadata:
namespace: kube-system
name: kube-scheduler
labels:
k8s-app: kube-scheduler
app.kubernetes.io/name: kube-scheduler
spec:
type: ClusterIP
clusterIP: None
ports:
- name: https-metrics
port: 10259
targetPort: 10259
protocol: TCP
---
apiVersion: v1
kind: Service
metadata:
namespace: kube-system
name: kube-controller-manager
labels:
k8s-app: kube-controller-manager
app.kubernetes.io/name: kube-controller-manager
spec:
type: ClusterIP
clusterIP: None
ports:
- name: https-metrics
port: 10257
targetPort: 10257
protocol: TCP
---
apiVersion: v1
kind: Service
metadata:
namespace: kube-system
name: kube-proxy
labels:
k8s-app: kube-proxy
app.kubernetes.io/name: kube-proxy
spec:
type: ClusterIP
clusterIP: None
ports:
- name: http-metrics
port: 10249
targetPort: 10249
protocol: TCP
6 changes: 6 additions & 0 deletions charts/microk8s-kube-metrics/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Default values for microk8s-kube-metrics.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.

# name -- The master node IP address which controller-manager, scheduler and kube-proxy are running on
masterIP: "test"

0 comments on commit 61ad760

Please sign in to comment.