diff --git a/esphome/deployment.yaml b/esphome/deployment.yaml new file mode 100644 index 0000000..df673b7 --- /dev/null +++ b/esphome/deployment.yaml @@ -0,0 +1,71 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + annotations: + name: esphome + namespace: esphome +spec: + replicas: 1 + selector: + matchLabels: + app.kubernetes.io/instance: esphome + app.kubernetes.io/name: esphome + strategy: + type: Recreate + template: + metadata: + labels: + app.kubernetes.io/instance: esphome + app.kubernetes.io/name: esphome + spec: + containers: + - name: esphome-esphome-release + env: + - name: TZ + value: Europe/Berlin + image: esphome/esphome:stable + imagePullPolicy: IfNotPresent + livenessProbe: + failureThreshold: 3 + periodSeconds: 10 + successThreshold: 1 + tcpSocket: + port: 6052 + timeoutSeconds: 1 + ports: + - containerPort: 6052 + name: http + protocol: TCP + readinessProbe: + failureThreshold: 3 + periodSeconds: 10 + successThreshold: 1 + tcpSocket: + port: 6052 + timeoutSeconds: 1 + resources: {} + startupProbe: + failureThreshold: 30 + periodSeconds: 5 + successThreshold: 1 + tcpSocket: + port: 6052 + timeoutSeconds: 1 + volumeMounts: + - mountPath: /config + name: config-volume + - mountPath: /cache + name: cache-volume + dnsPolicy: "None" + dnsConfig: + nameservers: + - 192.168.0.5 # YOUR DNS SERVER + searches: + - realm.local # YOUR DOMAIN NAME + volumes: + - name: config-volume + persistentVolumeClaim: + claimName: pvc-nfs-esphome + - name: cache-volume + emptyDir: + sizeLimit: 5Gi diff --git a/esphome/kustomization.yaml b/esphome/kustomization.yaml new file mode 100644 index 0000000..d2aafdc --- /dev/null +++ b/esphome/kustomization.yaml @@ -0,0 +1,6 @@ +namespace: esphome +resources: + - namespace.yaml + - pvc.yaml + - service.yaml + - deployment.yaml diff --git a/esphome/namespace.yaml b/esphome/namespace.yaml new file mode 100644 index 0000000..b84b8d0 --- /dev/null +++ b/esphome/namespace.yaml @@ -0,0 +1,4 @@ +apiVersion: v1 +kind: Namespace +metadata: + name: esphome diff --git a/esphome/pvc.yaml b/esphome/pvc.yaml new file mode 100644 index 0000000..2cc7809 --- /dev/null +++ b/esphome/pvc.yaml @@ -0,0 +1,13 @@ +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: pvc-nfs-esphome + namespace: esphome +spec: + accessModes: + - ReadWriteMany + resources: + requests: + storage: 10Mi + storageClassName: nfs-csi diff --git a/esphome/service.yaml b/esphome/service.yaml new file mode 100644 index 0000000..ddced65 --- /dev/null +++ b/esphome/service.yaml @@ -0,0 +1,35 @@ +--- +apiVersion: v1 +kind: Service +metadata: + name: esphome + namespace: esphome +spec: + ports: + - port: 80 + protocol: TCP + targetPort: 6052 + selector: + app.kubernetes.io/instance: esphome + app.kubernetes.io/name: esphome + sessionAffinity: None + type: ClusterIP +--- +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: esphome + namespace: esphome +spec: + ingressClassName: nginx + rules: + - host: esphome2.realm.local + http: + paths: + - backend: + service: + name: esphome + port: + number: 80 + path: / + pathType: Prefix