From 38da41577ba347c0c8aa1cb6f006aedfc23a91cd Mon Sep 17 00:00:00 2001 From: ducoterra Date: Thu, 9 Jul 2020 20:38:22 -0400 Subject: [PATCH] add iperf --- README.md | 15 ++++++++++- docker-compose.yaml | 21 ++++++---------- Dockerfile => glances/Dockerfile | 3 --- glances.conf => glances/glances.conf | 0 helm/templates/deploy.yaml | 37 ++++++++++++++++++++++++---- helm/templates/ingress.yaml | 4 +-- helm/templates/pvc.yaml | 23 +++++++++++++++++ helm/templates/service.yaml | 18 ++++++++++++-- helm/values.yaml | 2 +- iperf/Dockerfile | 8 ++++++ 10 files changed, 103 insertions(+), 28 deletions(-) rename Dockerfile => glances/Dockerfile (83%) rename glances.conf => glances/glances.conf (100%) create mode 100644 helm/templates/pvc.yaml create mode 100644 iperf/Dockerfile diff --git a/README.md b/README.md index b24206e..7b68248 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,11 @@ # Temperature monitoring and stress testing +## Install + +```bash +helm upgrade --install monitor ./helm +``` + ## Temperature ```bash @@ -15,5 +21,12 @@ kubectl exec -it $(kubectl get pod --selector=app=temp --output=jsonpath={.items ## Stress ```bash -kubectl exec -it $(kubectl get pod --selector=app=temp --output=jsonpath={.items..metadata.name}) -- stress -c 24 +kubectl exec -it $(kubectl get pod --selector=app=temp --output=jsonpath={.items..metadata.name}) -- stress -c 48 ``` + +## Disk + +```bash +dd if=/dev/zero of=/tmp/nfs/output bs=16k count=100k; dd if=/tmp/nfs/output of=/dev/null; rm -f /tmp/nfs/output +dd if=/dev/zero of=/tmp/nvme/output bs=16k count=100k; dd if=/tmp/nvme/output of=/dev/null; rm -f /tmp/nvme/output +``` \ No newline at end of file diff --git a/docker-compose.yaml b/docker-compose.yaml index 8710d83..9ee42ff 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -1,23 +1,16 @@ version: '3' services: - web: - image: hub.ducoterra.net/ducoterra/temp:0.0.8 - build: . + glances: + build: glances + image: hub.ducoterra.net/ducoterra/glances:latest ports: - 61208:61208 - command: glances -w - volumes: - - web_tmp:/tmp - exporter: - image: hub.ducoterra.net/ducoterra/temp:0.0.8 - command: glances -q --export statsd - volumes: - - exporter_tmp:/tmp - graphite-statsd: - image: hub.ducoterra.net/ducoterra/graphite:0.0.1 + iperf: + build: iperf + image: hub.ducoterra.net/ducoterra/iperf:latest ports: - - 8080:80 + - 5201:5201 volumes: web_tmp: diff --git a/Dockerfile b/glances/Dockerfile similarity index 83% rename from Dockerfile rename to glances/Dockerfile index b0a8c39..eb621c3 100644 --- a/Dockerfile +++ b/glances/Dockerfile @@ -5,7 +5,4 @@ RUN pip install glances bottle statsd pysnmp COPY glances.conf /etc/glances/glances.conf -RUN useradd -m glances -USER glances - CMD glances -w \ No newline at end of file diff --git a/glances.conf b/glances/glances.conf similarity index 100% rename from glances.conf rename to glances/glances.conf diff --git a/helm/templates/deploy.yaml b/helm/templates/deploy.yaml index bb1a649..e94b396 100644 --- a/helm/templates/deploy.yaml +++ b/helm/templates/deploy.yaml @@ -13,8 +13,10 @@ spec: app: {{ .Release.Name }} spec: containers: - - name: {{ .Release.Name }}-web - image: {{ .Values.image }} + - name: glances + image: hub.ducoterra.net/ducoterra/glances:latest + ports: + - containerPort: 61208 resources: requests: memory: 1Mi @@ -22,8 +24,26 @@ spec: limits: memory: 512Mi cpu: "48" - - name: {{ .Release.Name }}-exporter - image: {{ .Values.image }} + volumeMounts: + - mountPath: /tmp/nfs + name: {{ .Release.Name }}-nfs + - mountPath: /tmp/nvme + name: {{ .Release.Name }}-nvme + - name: iperf + image: hub.ducoterra.net/ducoterra/iperf:latest + tty: true + stdin: true + ports: + - containerPort: 5201 + resources: + requests: + memory: 128Mi + cpu: 250m + limits: + memory: 512Mi + cpu: 500m + - name: exporter + image: hub.ducoterra.net/ducoterra/glances:latest command: ["glances", "-q", "--export", "statsd"] resources: requests: @@ -31,4 +51,11 @@ spec: cpu: 1m limits: memory: 512Mi - cpu: 250m \ No newline at end of file + cpu: 250m + volumes: + - name: {{ .Release.Name }}-nfs + persistentVolumeClaim: + claimName: {{ .Release.Name }}-nfs + - name: {{ .Release.Name }}-nvme + persistentVolumeClaim: + claimName: {{ .Release.Name }}-nvme \ No newline at end of file diff --git a/helm/templates/ingress.yaml b/helm/templates/ingress.yaml index 373f3bd..9b4b4d2 100644 --- a/helm/templates/ingress.yaml +++ b/helm/templates/ingress.yaml @@ -15,7 +15,7 @@ spec: - match: Host(`{{ .Release.Name }}.ducoterra.net`) kind: Rule services: - - name: {{ .Release.Name }} + - name: {{ .Release.Name }}-glances port: 61208 --- @@ -33,7 +33,7 @@ spec: - match: Host(`{{ .Release.Name }}.ducoterra.net`) kind: Rule services: - - name: {{ .Release.Name }} + - name: {{ .Release.Name }}-glances port: 61208 middlewares: - name: httpsredirect \ No newline at end of file diff --git a/helm/templates/pvc.yaml b/helm/templates/pvc.yaml new file mode 100644 index 0000000..98e6c61 --- /dev/null +++ b/helm/templates/pvc.yaml @@ -0,0 +1,23 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: {{ .Release.Name }}-nfs +spec: + storageClassName: hdd + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 16Gi +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: {{ .Release.Name }}-nvme +spec: + storageClassName: nvme + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 16Gi \ No newline at end of file diff --git a/helm/templates/service.yaml b/helm/templates/service.yaml index d05d508..c979724 100644 --- a/helm/templates/service.yaml +++ b/helm/templates/service.yaml @@ -1,10 +1,24 @@ apiVersion: v1 kind: Service metadata: - name: {{ .Release.Name }} + name: {{ .Release.Name }}-glances spec: selector: app: {{ .Release.Name }} ports: - port: 61208 - targetPort: 61208 \ No newline at end of file + targetPort: 61208 +--- +apiVersion: v1 +kind: Service +metadata: + name: {{ .Release.Name }}-iperf +spec: + selector: + app: {{ .Release.Name }} + ports: + - port: 5201 + targetPort: 5201 + externalIPs: + - 6.0.22.1 + type: LoadBalancer \ No newline at end of file diff --git a/helm/values.yaml b/helm/values.yaml index 9b2cfed..5ee5b33 100644 --- a/helm/values.yaml +++ b/helm/values.yaml @@ -1 +1 @@ -image: hub.ducoterra.net/ducoterra/temp:0.0.8 \ No newline at end of file +image: hub.ducoterra.net/ducoterra/temp:0.0.10 \ No newline at end of file diff --git a/iperf/Dockerfile b/iperf/Dockerfile new file mode 100644 index 0000000..12e0af0 --- /dev/null +++ b/iperf/Dockerfile @@ -0,0 +1,8 @@ +FROM debian:latest + +RUN apt update +RUN apt install -y iperf3 + +EXPOSE 5201 + +CMD iperf3 -s \ No newline at end of file