Skip to content

Commit

Permalink
Merge pull request #9 from domhauton/add-k8s
Browse files Browse the repository at this point in the history
Add example kubernetes manifests
  • Loading branch information
metalmatze authored Sep 10, 2019
2 parents abb595c + f29a3b9 commit bc16d92
Show file tree
Hide file tree
Showing 2 changed files with 128 additions and 2 deletions.
16 changes: 14 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,20 @@ ENV Variable | Description
docker pull metalmatze/transmission-exporter
docker run -d -p 19091:19091 metalmatze/transmission-exporter

### Kubernetes (Prometheus)

A sample kubernetes manifest is available in [example/kubernetes](https://github.com/metalmatze/transmission-exporter/blob/master/examples/kubernetes/docker-compose.yml)

Please run: `kubectl apply -f examples/kubernetes/transmission.yml`

You should:
* Attach the config and downloads volume
* Configure the password for the exporter

Your prometheus instance will start scraping the metrics automatically. (if configured with annotation based discovery). [more info](https://www.weave.works/docs/cloud/latest/tasks/monitor/configuration-k8s/)

### Docker Compose

Example `docker-compose.yml` with Transmission also running in docker.

transmission:
Expand Down Expand Up @@ -55,5 +69,3 @@ Now you're good to go.
### Original authors of the Transmission package
Tobias Blom (https://github.com/tubbebubbe/transmission)
Long Nguyen (https://github.com/longnguyen11288/go-transmission)


114 changes: 114 additions & 0 deletions examples/kubernetes/transmission.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
---
apiVersion: v1
kind: Namespace
metadata:
name: transmission
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: transmission
namespace: transmission
spec:
replicas: 1
selector:
matchLabels:
name: transmission
template:
metadata:
labels:
name: transmission
annotations:
prometheus.io/scrape: 'true'
prometheus.io/port: '9190'
spec:
containers:
- image: linuxserver/transmission
imagePullPolicy: Always
name: transmission
env:
- name: PGID
value: "1000"
- name: "PUID"
value: "1000"
- name: "TZ"
value: "Europe/London"
resources:
limits:
cpu: 2000m
memory: 2000Mi
requests:
cpu: 1000m
memory: 1000Mi
ports:
- name: default-http
containerPort: 9091
- name: dht
containerPort: 51413
- name: dht-udp
containerPort: 51413
protocol: UDP
# You should assign these to some real volumes
# volumeMounts:
# - name: downloads
# mountPath: "/downloads"
# - name: config
# mountPath: "/config"
- image: metalmatze/transmission-exporter
name: transmission-exporter
imagePullPolicy: Always
resources:
limits:
cpu: 100m
memory: 100Mi
requests:
cpu: 50m
memory: 50Mi
ports:
- name: prom-scrape
containerPort: 9190
env:
- name: TRANSMISSION_ADDR
value: "http://localhost:9091"
# Uncomment these once you add authentication to transmission
# - name: TRANSMISSION_USERNAME
# value: "transmission"
# You can use a tool like `kontemplate` + `pass` to avoid hardcoding this in your repo
# - name: TRANSMISSION_PASSWORD
# value: "hunter2"
- name: WEB_PATH
value: "/metrics"
- name: WEB_ADDR
value: ":9190"
# You should create some real PVCs for this
#
# volumes:
# - name: downloads
# persistentVolumeClaim:
# claimName: transmission-downloads
# - name: config
# persistentVolumeClaim:
# claimName: transmission-config
---
apiVersion: v1
kind: Service
metadata:
namespace: transmission
name: transmission
spec:
selector:
name: transmission
ports:
- name: default-http
protocol: TCP
port: 80
targetPort: 9091
- name: dht
protocol: TCP
port: 51413
targetPort: 51413
- name: dht-udp
protocol: UDP
port: 51413
targetPort: 51413
---

0 comments on commit bc16d92

Please sign in to comment.