From 738c111a59afc2a2110b236fa7fa8a34be468a33 Mon Sep 17 00:00:00 2001 From: Aaron Brown Date: Sun, 6 Nov 2022 20:00:42 +1000 Subject: [PATCH] Use kubernetes secret for config.ini file. --- kubernetes/pygrowatt-deployment.yaml | 12 ++++++++++++ kubernetes/pygrowatt-secret.yaml | 20 ++++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 kubernetes/pygrowatt-secret.yaml diff --git a/kubernetes/pygrowatt-deployment.yaml b/kubernetes/pygrowatt-deployment.yaml index d7cdf08..455f5b9 100644 --- a/kubernetes/pygrowatt-deployment.yaml +++ b/kubernetes/pygrowatt-deployment.yaml @@ -17,6 +17,13 @@ spec: labels: app: pygrowatt spec: + volumes: + - name: pygrowatt-config + secret: + secretName: pygrowatt-config + items: + - key: config.ini + path: config.ini containers: - name: pygrowatt-container image: pygrowatt @@ -26,6 +33,11 @@ spec: ports: - containerPort: 5279 protocol: TCP + volumeMounts: + - mountPath: "/opt/PyGrowatt/scripts/config.ini" + subPath: "config.ini" + name: pygrowatt-config + readOnly: true --- apiVersion: v1 kind: Service diff --git a/kubernetes/pygrowatt-secret.yaml b/kubernetes/pygrowatt-secret.yaml new file mode 100644 index 0000000..4e46751 --- /dev/null +++ b/kubernetes/pygrowatt-secret.yaml @@ -0,0 +1,20 @@ +--- +apiVersion: v1 +kind: Secret +metadata: + name: pygrowatt-config +type: Opaque +stringData: + config.ini: |- + [Growatt] + KEY = Growatt + UpdateInterval = 5 + + [Pvoutput] + Apikey = Your-API-Key + SystemId = Your-System-Id + StatusInterval = 5 + + [MQTT] + ServerIP = test.mosquitto.org + ServerPort = 1883 \ No newline at end of file