Created
December 19, 2022 06:18
-
-
Save itudoben/2840936bb15267d86d2b60a77c94d32e to your computer and use it in GitHub Desktop.
gke client-2.0
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: apps/v1 | |
kind: Deployment | |
metadata: | |
name: telegraf-deployment | |
namespace: {{.Env.NAMESPACE}} | |
spec: | |
replicas: 1 | |
minReadySeconds: 10 | |
selector: | |
matchLabels: | |
app: telegraf | |
role: monitor | |
template: | |
metadata: | |
labels: | |
app: telegraf | |
role: monitor | |
spec: | |
tolerations: | |
- key: "benchmark.siren.io/job" | |
operator: "Equal" | |
value: "client-2.0" | |
effect: "NoSchedule" | |
affinity: | |
nodeAffinity: | |
requiredDuringSchedulingIgnoredDuringExecution: | |
nodeSelectorTerms: | |
- matchExpressions: | |
{{.Env.NODE_SELECTOR}} | |
podAntiAffinity: | |
requiredDuringSchedulingIgnoredDuringExecution: | |
- labelSelector: | |
matchExpressions: | |
- key: role | |
operator: In | |
values: | |
- data | |
- master | |
- main | |
topologyKey: "kubernetes.io/hostname" | |
containers: | |
- image: telegraf:1.23.0 | |
name: telegraf | |
resources: | |
limits: | |
memory: 2Gi | |
cpu: 1 | |
command: | |
- /bin/bash | |
- -c | |
- | | |
# Install jq | |
JQ_VERSION='1.6' | |
wget --no-check-certificate https://raw.githubusercontent.com/stedolan/jq/master/sig/jq-release.key -O /tmp/jq-release.key && \ | |
wget --no-check-certificate https://raw.githubusercontent.com/stedolan/jq/master/sig/v${JQ_VERSION}/jq-linux64.asc -O /tmp/jq-linux64.asc && \ | |
wget --no-check-certificate https://github.com/stedolan/jq/releases/download/jq-${JQ_VERSION}/jq-linux64 -O /tmp/jq-linux64 && \ | |
gpg --import /tmp/jq-release.key && \ | |
gpg --verify /tmp/jq-linux64.asc /tmp/jq-linux64 && \ | |
cp /tmp/jq-linux64 /usr/bin/jq && \ | |
chmod +x /usr/bin/jq && \ | |
rm -f /tmp/jq-release.key && \ | |
rm -f /tmp/jq-linux64.asc && \ | |
rm -f /tmp/jq-linux64 | |
# Create the script for getting Federate nodes memory stats | |
cp "/secrets-dir/script-get-stats" $HOME/get-nodes-stats-memory.sh | |
chmod +x $HOME/get-nodes-stats-memory.sh | |
# Execute Telegraf | |
export TELEGRAF_BENCHMARK_UUID CLUSTER_URL METRICS_FEDERATE_PASSWORD SCRIPT_PATH=$HOME | |
telegraf /etc/telegraf/telegraf.conf # --test --input-filter exec --debug | |
volumeMounts: | |
- mountPath: /etc/telegraf/telegraf.conf | |
name: telegraf-config | |
subPath: telegraf.conf | |
readOnly: true | |
- name: vol-telegraf-secrets | |
mountPath: /secrets-dir | |
readOnly: true | |
envFrom: | |
- secretRef: | |
name: {{.Env.SECRET_NAME}} | |
volumes: | |
- name: telegraf-config | |
configMap: | |
name: telegraf-config | |
- name: vol-telegraf-secrets | |
secret: | |
secretName: {{.Env.SECRET_NAME}} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment