diff --git a/README.md b/README.md index 9b57387..1779f99 100644 --- a/README.md +++ b/README.md @@ -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: @@ -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) - - diff --git a/examples/kubernetes/transmission.yml b/examples/kubernetes/transmission.yml new file mode 100644 index 0000000..0eda58b --- /dev/null +++ b/examples/kubernetes/transmission.yml @@ -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 +---