mirror of
https://github.com/helm/charts.git
synced 2026-08-23 22:37:45 +00:00
Add cloudwatch exporter (#4022)
* Add cloudwatch-exporter chart * Add readme * Review readme * fix lint errors * Review chart * Review chart * move to stable and rename chart to prometheus-cloudwatch-exporter * Addedd myself as a owner * fix ci * review table format
This commit is contained in:
committed by
k8s-ci-robot
parent
b2b2c5d73c
commit
0f730f26eb
@@ -0,0 +1,21 @@
|
||||
# Patterns to ignore when building packages.
|
||||
# This supports shell glob matching, relative path matching, and
|
||||
# negation (prefixed with !). Only one pattern per line.
|
||||
.DS_Store
|
||||
# Common VCS dirs
|
||||
.git/
|
||||
.gitignore
|
||||
.bzr/
|
||||
.bzrignore
|
||||
.hg/
|
||||
.hgignore
|
||||
.svn/
|
||||
# Common backup files
|
||||
*.swp
|
||||
*.bak
|
||||
*.tmp
|
||||
*~
|
||||
# Various IDEs
|
||||
.project
|
||||
.idea/
|
||||
*.tmproj
|
||||
@@ -0,0 +1,15 @@
|
||||
apiVersion: v1
|
||||
appVersion: "0.1.0"
|
||||
description: A Helm chart for prometheus cloudwatch-exporter
|
||||
name: prometheus-cloudwatch-exporter
|
||||
version: 0.1.0
|
||||
sources:
|
||||
- https://github.com/prometheus/cloudwatch_exporter
|
||||
keywords:
|
||||
- aws
|
||||
- cloudwatch
|
||||
- prometheus
|
||||
- exporter
|
||||
maintainers:
|
||||
- email: gianrubio@gmail.com
|
||||
name: gianrubio
|
||||
@@ -0,0 +1,4 @@
|
||||
approvers:
|
||||
- gianrubio
|
||||
reviewers:
|
||||
- gianrubio
|
||||
@@ -0,0 +1,80 @@
|
||||
# Cloudwatch exporter
|
||||
|
||||
* Installs [cloudwatch exporter](http://github.com/prometheus/cloudwatch_exporter)
|
||||
|
||||
## TL;DR;
|
||||
|
||||
```console
|
||||
$ helm install stable/prometheus-cloudwatch-exporter
|
||||
```
|
||||
|
||||
## Introduction
|
||||
|
||||
This chart bootstraps a [cloudwatch exporter](http://github.com/prometheus/cloudwatch_exporter) deployment on a [Kubernetes](http://kubernetes.io) cluster using the [Helm](https://helm.sh) package manager.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- [kube2iam](../../stable/kube2iam) installed to used the **aws.role** config option otherwise configure **aws.aws_access_key_id** and **aws.aws_secret_access_key**
|
||||
|
||||
## Installing the Chart
|
||||
|
||||
To install the chart with the release name `my-release`:
|
||||
|
||||
```console
|
||||
$ # edit aws.aws_access_key_id and aws.aws_access_key_id with the key/password of a AWS user with a policy to access Cloudwatch
|
||||
$ helm install --name my-release stable/prometheus-cloudwatch-exporter
|
||||
$ # or add a role to aws with the [correct policy](https://github.com/prometheus/cloudwatch_exporter#credentials-and-permissions) to add to cloud watch
|
||||
$ helm install --name my-release stable/prometheus-cloudwatch-exporter --set awsRole=roll_name_here
|
||||
```
|
||||
|
||||
The command deploys Cloudwatch exporter on the Kubernetes cluster in the default configuration. The [configuration](#configuration) section lists the parameters that can be configured during installation.
|
||||
|
||||
## Uninstalling the Chart
|
||||
|
||||
To uninstall/delete the `my-release` deployment:
|
||||
|
||||
```console
|
||||
$ helm delete my-release
|
||||
```
|
||||
|
||||
The command removes all the Kubernetes components associated with the chart and deletes the release.
|
||||
|
||||
## Configuration
|
||||
|
||||
The following tables lists the configurable parameters of the Cloudwatch Exporter chart and their default values.
|
||||
|
||||
| Parameter | Description | Default |
|
||||
| --------------------------- | ------------------------------------------------------ | -------------------------- |
|
||||
| `image` | Image | `prom/cloudwatch-exporter` |
|
||||
| `imageTag` | Image tag | `latest` |
|
||||
| `imagePullPolicy` | Image pull policy | `IfNotPresent` |
|
||||
| `service.type` | Service type | `ClusterIP` |
|
||||
| `service.port` | The service port | `80` |
|
||||
| `service.targetPort` | The target port of the container | `9100` |
|
||||
| `resources` | | `{}` |
|
||||
| `aws.region` | AWS Cloudwatch region | `eu-west-1` |
|
||||
| `aws.role` | AWS IAM Role To Use | |
|
||||
| `aws.aws_access_key_id` | AWS access key id | |
|
||||
| `aws.aws_secret_access_key` | AWS secret access key | |
|
||||
| `config` | Cloudwatch exporter configuration | `example configuration` |
|
||||
| `rbac.create` | If true, create & use RBAC resources | `false` |
|
||||
| `serviceAccount.create` | Specifies whether a service account should be created. | `true` |
|
||||
| `serviceAccount.name` | Name of the service account. | |
|
||||
| `tolerations` | Add tolerations | `[]` |
|
||||
| `nodeSelector` | node labels for pod assignment | `{}` |
|
||||
| `affinity` | node/pod affinities | `{}` |
|
||||
|
||||
|
||||
Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example,
|
||||
|
||||
```console
|
||||
$ helm install --name my-release \
|
||||
--set aws.region=us-east-1 --set aws.role=my-aws-role \
|
||||
stable/prometheus-cloudwatch-exporter
|
||||
```
|
||||
|
||||
Alternatively, a YAML file that specifies the values for the above parameters can be provided while installing the chart. For example,
|
||||
|
||||
```console
|
||||
$ helm install --name my-release -f values.yaml stable/prometheus-cloudwatch-exporter
|
||||
```
|
||||
@@ -0,0 +1,15 @@
|
||||
1. Get the application URL by running these commands:
|
||||
{{- if contains "NodePort" .Values.service.type }}
|
||||
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "prometheus-cloudwatch-exporter.fullname" . }})
|
||||
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
|
||||
echo http://$NODE_IP:$NODE_PORT
|
||||
{{- else if contains "LoadBalancer" .Values.service.type }}
|
||||
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
|
||||
You can watch the status of by running 'kubectl get svc -w {{ template "prometheus-cloudwatch-exporter.fullname" . }}'
|
||||
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "prometheus-cloudwatch-exporter.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
|
||||
echo http://$SERVICE_IP:{{ .Values.service.port }}
|
||||
{{- else if contains "ClusterIP" .Values.service.type }}
|
||||
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ template "prometheus-cloudwatch-exporter.name" . }},release={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
|
||||
echo "Visit http://127.0.0.1:8080 to use your application"
|
||||
kubectl port-forward $POD_NAME 8080:80
|
||||
{{- end }}
|
||||
@@ -0,0 +1,32 @@
|
||||
{{/* vim: set filetype=mustache: */}}
|
||||
{{/*
|
||||
Expand the name of the chart.
|
||||
*/}}
|
||||
{{- define "prometheus-cloudwatch-exporter.name" -}}
|
||||
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Create a default fully qualified app name.
|
||||
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
|
||||
If release name contains chart name it will be used as a full name.
|
||||
*/}}
|
||||
{{- define "prometheus-cloudwatch-exporter.fullname" -}}
|
||||
{{- if .Values.fullnameOverride -}}
|
||||
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
|
||||
{{- else -}}
|
||||
{{- $name := default .Chart.Name .Values.nameOverride -}}
|
||||
{{- if contains $name .Release.Name -}}
|
||||
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
|
||||
{{- else -}}
|
||||
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Create chart name and version as used by the chart label.
|
||||
*/}}
|
||||
{{- define "prometheus-cloudwatch-exporter.chart" -}}
|
||||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
@@ -0,0 +1,16 @@
|
||||
{{- if .Values.rbac.create }}
|
||||
apiVersion: rbac.authorization.k8s.io/v1beta1
|
||||
kind: ClusterRole
|
||||
metadata:
|
||||
name: {{ template "prometheus-cloudwatch-exporter.fullname" . }}
|
||||
labels:
|
||||
app: {{ template "prometheus-cloudwatch-exporter.name" . }}
|
||||
chart: {{ template "prometheus-cloudwatch-exporter.chart" . }}
|
||||
release: {{ .Release.Name }}
|
||||
heritage: {{ .Release.Service }}
|
||||
rules:
|
||||
- apiGroups: [""]
|
||||
resources: ["secrets","configmap"]
|
||||
resourceNames: ["{{ template "prometheus-cloudwatch-exporter.fullname" . }}"]
|
||||
verbs: ["get"]
|
||||
{{- end }}
|
||||
@@ -0,0 +1,19 @@
|
||||
{{ if .Values.rbac.create }}
|
||||
apiVersion: rbac.authorization.k8s.io/v1beta1
|
||||
kind: ClusterRoleBinding
|
||||
metadata:
|
||||
name: {{ template "prometheus-cloudwatch-exporter.fullname" . }}
|
||||
labels:
|
||||
app: {{ template "prometheus-cloudwatch-exporter.name" . }}
|
||||
chart: {{ template "prometheus-cloudwatch-exporter.chart" . }}
|
||||
release: {{ .Release.Name }}
|
||||
heritage: {{ .Release.Service }}
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: {{ template "prometheus-cloudwatch-exporter.fullname" . }}
|
||||
namespace: {{ .Release.Namespace }}
|
||||
roleRef:
|
||||
kind: ClusterRole
|
||||
name: {{ template "prometheus-cloudwatch-exporter.fullname" . }}
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
{{ end }}
|
||||
@@ -0,0 +1,12 @@
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: {{ template "prometheus-cloudwatch-exporter.fullname" . }}
|
||||
labels:
|
||||
app: {{ template "prometheus-cloudwatch-exporter.name" . }}
|
||||
chart: {{ template "prometheus-cloudwatch-exporter.chart" . }}
|
||||
release: {{ .Release.Name }}
|
||||
heritage: {{ .Release.Service }}
|
||||
data:
|
||||
config.yaml: |
|
||||
{{ printf .Values.config | indent 4 }}
|
||||
@@ -0,0 +1,82 @@
|
||||
apiVersion: apps/v1beta2
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: {{ template "prometheus-cloudwatch-exporter.fullname" . }}
|
||||
labels:
|
||||
app: {{ template "prometheus-cloudwatch-exporter.name" . }}
|
||||
chart: {{ template "prometheus-cloudwatch-exporter.chart" . }}
|
||||
release: {{ .Release.Name }}
|
||||
heritage: {{ .Release.Service }}
|
||||
spec:
|
||||
replicas: {{ .Values.replicaCount }}
|
||||
selector:
|
||||
matchLabels:
|
||||
app: {{ template "prometheus-cloudwatch-exporter.name" . }}
|
||||
release: {{ .Release.Name }}
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: {{ template "prometheus-cloudwatch-exporter.name" . }}
|
||||
release: {{ .Release.Name }}
|
||||
annotations:
|
||||
{{ if .Values.aws.role}}iam.amazonaws.com/role: {{ .Values.aws.role }}{{ end }}
|
||||
spec:
|
||||
containers:
|
||||
- name: {{ .Chart.Name }}
|
||||
command:
|
||||
- java
|
||||
- -jar
|
||||
- /cloudwatch_exporter.jar
|
||||
- "{{ .Values.service.targetPort }}"
|
||||
- /config/config.yaml
|
||||
{{- if not .Values.aws.role }}
|
||||
{{- if and .Values.aws.secretKey .Values.aws.accessKey }}
|
||||
env:
|
||||
- name: AWS_ACCESS_KEY_ID
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
key: aws_access_key_id
|
||||
name: {{ template "prometheus-cloudwatch-exporter.fullname" . }}
|
||||
- name: AWS_SECRET_ACCESS_KEY
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
key: aws_secret_access_key
|
||||
name: {{ template "prometheus-cloudwatch-exporter.fullname" . }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
|
||||
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||
ports:
|
||||
- name: http
|
||||
containerPort: {{ .Values.service.targetPort }}
|
||||
protocol: TCP
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
path: /
|
||||
port: http
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /
|
||||
port: http
|
||||
resources:
|
||||
{{ toYaml .Values.resources | indent 12 }}
|
||||
volumeMounts:
|
||||
- name: vol-prometheus-cloudwatch-exporter
|
||||
mountPath: /config
|
||||
{{- with .Values.nodeSelector }}
|
||||
nodeSelector:
|
||||
{{ toYaml . | indent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.affinity }}
|
||||
affinity:
|
||||
{{ toYaml . | indent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.tolerations }}
|
||||
tolerations:
|
||||
{{ toYaml . | indent 8 }}
|
||||
{{- end }}
|
||||
volumes:
|
||||
- configMap:
|
||||
defaultMode: 420
|
||||
name: {{ template "prometheus-cloudwatch-exporter.fullname" . }}
|
||||
name: vol-prometheus-cloudwatch-exporter
|
||||
@@ -0,0 +1,14 @@
|
||||
{{- if not .Values.aws.role }}
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: {{ template "prometheus-cloudwatch-exporter.fullname" . }}
|
||||
labels:
|
||||
app: {{ template "prometheus-cloudwatch-exporter.name" . }}
|
||||
chart: {{ template "prometheus-cloudwatch-exporter.chart" . }}
|
||||
heritage: {{ .Release.Service }}
|
||||
release: {{ .Release.Name }}
|
||||
type: Opaque
|
||||
data:
|
||||
{{ (.Files.Glob "secrets/*").AsSecrets | indent 2 }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,19 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ template "prometheus-cloudwatch-exporter.fullname" . }}
|
||||
labels:
|
||||
app: {{ template "prometheus-cloudwatch-exporter.name" . }}
|
||||
chart: {{ template "prometheus-cloudwatch-exporter.chart" . }}
|
||||
release: {{ .Release.Name }}
|
||||
heritage: {{ .Release.Service }}
|
||||
spec:
|
||||
type: {{ .Values.service.type }}
|
||||
ports:
|
||||
- port: {{ .Values.service.port }}
|
||||
targetPort: {{ .Values.service.targetPort }}
|
||||
protocol: TCP
|
||||
name: http
|
||||
selector:
|
||||
app: {{ template "prometheus-cloudwatch-exporter.name" . }}
|
||||
release: {{ .Release.Name }}
|
||||
@@ -0,0 +1,11 @@
|
||||
{{- if .Values.serviceAccount.create }}
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: {{ template "prometheus-cloudwatch-exporter.fullname" . }}
|
||||
labels:
|
||||
app: {{ template "prometheus-cloudwatch-exporter.name" . }}
|
||||
chart: {{ template "prometheus-cloudwatch-exporter.chart" . }}
|
||||
release: "{{ .Release.Name }}"
|
||||
heritage: "{{ .Release.Service }}"
|
||||
{{- end }}
|
||||
@@ -0,0 +1,82 @@
|
||||
# Default values for prometheus-cloudwatch-exporter.
|
||||
# This is a YAML-formatted file.
|
||||
# Declare variables to be passed into your templates.
|
||||
|
||||
replicaCount: 1
|
||||
|
||||
image:
|
||||
repository: prom/cloudwatch-exporter
|
||||
tag: latest
|
||||
pullPolicy: IfNotPresent
|
||||
|
||||
service:
|
||||
type: ClusterIP
|
||||
port: 80
|
||||
targetPort: 9100
|
||||
|
||||
resources: {}
|
||||
# We usually recommend not to specify default resources and to leave this as a conscious
|
||||
# choice for the user. This also increases chances charts run on environments with little
|
||||
# resources, such as Minikube. If you do want to specify resources, uncomment the following
|
||||
# lines, adjust them as necessary, and remove the curly braces after 'resources:'.
|
||||
# limits:
|
||||
# cpu: 100m
|
||||
# memory: 128Mi
|
||||
# requests:
|
||||
# cpu: 100m
|
||||
# memory: 128Mi
|
||||
|
||||
aws:
|
||||
region: eu-west-1
|
||||
role:
|
||||
# Note: Do not specify the aws_access_key_id abd aws_secret_access_key if you specified role before
|
||||
aws_access_key_id:
|
||||
aws_secret_access_key:
|
||||
|
||||
serviceAccount:
|
||||
# Specifies whether a ServiceAccount should be created
|
||||
create: true
|
||||
# The name of the ServiceAccount to use.
|
||||
# If not set and create is true, a name is generated using the fullname template
|
||||
name:
|
||||
|
||||
rbac:
|
||||
# Specifies whether RBAC resources should be created
|
||||
create: true
|
||||
|
||||
config: |-
|
||||
# This is the default configuration for prometheus-cloudwatch-exporter
|
||||
region: eu-west-1
|
||||
period_seconds: 240
|
||||
metrics:
|
||||
- aws_namespace: AWS/ELB
|
||||
aws_metric_name: HealthyHostCount
|
||||
aws_dimensions: [AvailabilityZone, LoadBalancerName]
|
||||
aws_statistics: [Average]
|
||||
|
||||
- aws_namespace: AWS/ELB
|
||||
aws_metric_name: UnHealthyHostCount
|
||||
aws_dimensions: [AvailabilityZone, LoadBalancerName]
|
||||
aws_statistics: [Average]
|
||||
|
||||
- aws_namespace: AWS/ELB
|
||||
aws_metric_name: RequestCount
|
||||
aws_dimensions: [AvailabilityZone, LoadBalancerName]
|
||||
aws_statistics: [Sum]
|
||||
|
||||
- aws_namespace: AWS/ELB
|
||||
aws_metric_name: Latency
|
||||
aws_dimensions: [AvailabilityZone, LoadBalancerName]
|
||||
aws_statistics: [Average]
|
||||
|
||||
- aws_namespace: AWS/ELB
|
||||
aws_metric_name: SurgeQueueLength
|
||||
aws_dimensions: [AvailabilityZone, LoadBalancerName]
|
||||
aws_statistics: [Maximum, Sum]
|
||||
|
||||
|
||||
nodeSelector: {}
|
||||
|
||||
tolerations: []
|
||||
|
||||
affinity: {}
|
||||
Reference in New Issue
Block a user