โ† Back to the chapter

Technical detail ยท Edge Container Orchestration: Images and Kubernetes

Read the Deployment and Service manifest

apiVersion: apps/v1
kind: Deployment
metadata:
  name: telemetry-ingest
  labels:
    app.kubernetes.io/name: telemetry-ingest
spec:
  replicas: 3
  selector:
    matchLabels:
      app.kubernetes.io/name: telemetry-ingest
  template:
    metadata:
      labels:
        app.kubernetes.io/name: telemetry-ingest
    spec:
      containers:
        - name: service
          image: ghcr.io/acme/telemetry-ingest:1.4.0
          ports:
            - containerPort: 8080
          envFrom:
            - configMapRef:
                name: telemetry-ingest-config
          volumeMounts:
            - name: device-ca
              mountPath: /var/run/iot-ca
              readOnly: true
          resources:
            requests:
              cpu: 250m
              memory: 256Mi
            limits:
              memory: 512Mi
          startupProbe:
            httpGet:
              path: /startup
              port: 8080
            failureThreshold: 12
            periodSeconds: 5
          readinessProbe:
            httpGet:
              path: /ready
              port: 8080
            periodSeconds: 5
          livenessProbe:
            httpGet:
              path: /live
              port: 8080
            periodSeconds: 20
      volumes:
        - name: device-ca
          secret:
            secretName: telemetry-device-ca
---
apiVersion: v1
kind: Service
metadata:
  name: telemetry-ingest
spec:
  selector:
    app.kubernetes.io/name: telemetry-ingest
  ports:
    - port: 80
      targetPort: 8080

The Deployment requests 250m CPU and 256Mi memory per pod, with a 512Mi memory limit. It starts three replicas of ghcr.io/acme/telemetry-ingest:1.4.0 on port 8080. Configuration comes from telemetry-ingest-config; telemetry-device-ca is mounted read-only at /var/run/iot-ca. The startup probe allows 12 failed checks at five-second intervals. Readiness runs every five seconds, and liveness every 20 seconds. The Service maps port 80 to port 8080.

โ† Back to the chapter