--- apiVersion: v1 kind: ConfigMap metadata: annotations: {} name: iot-api-config namespace: iot data: MYSQL_DATABASE: iot_db --- # NOTE: iot-api uses image 'iot-api:latest' with imagePullPolicy=Never # The image must be built and loaded onto the scheduled node before deploying. # Current status: ErrImageNeverPull on kube-node-3 — image not present there. # To fix: either add nodeSelector to pin to a node with the image, or push the # image to a registry and change imagePullPolicy to Always. --- apiVersion: apps/v1 kind: Deployment metadata: annotations: {} name: iot-api namespace: iot spec: replicas: 1 selector: matchLabels: app: iot-api template: metadata: labels: app: iot-api spec: nodeSelector: topology.homelab/server: dell containers: - env: - name: MYSQL_USER valueFrom: secretKeyRef: key: user name: iot-db-secret - name: MYSQL_PASSWORD valueFrom: secretKeyRef: key: password name: iot-db-secret envFrom: - configMapRef: name: iot-api-config image: iot-api:latest imagePullPolicy: Never livenessProbe: failureThreshold: 5 httpGet: path: / port: 8000 initialDelaySeconds: 30 periodSeconds: 30 timeoutSeconds: 10 name: iot-api ports: - containerPort: 8000 name: http readinessProbe: failureThreshold: 5 httpGet: path: / port: 8000 initialDelaySeconds: 10 periodSeconds: 10 timeoutSeconds: 10 resources: limits: cpu: 200m memory: 256Mi requests: cpu: 50m memory: 128Mi --- apiVersion: v1 kind: Service metadata: annotations: {} name: iot-api namespace: iot spec: ports: - name: http nodePort: 30800 port: 8000 targetPort: 8000 selector: app: iot-api type: NodePort