Lecture 9

Contents

Exam Question: IoT Microservices, Docker & Kubernetes

Time Allocation: 25 minutes
Total Marks: 25


Question

A smart manufacturing company is redesigning its monolithic Industrial IoT (IIoT) platform into a microservices-based architecture to improve scalability, resilience, and edge autonomy. The platform collects, processes, and analyses sensor data from machines deployed across multiple factories.

The system will include the following services:

  • Device Ingestion Service: Receives sensor data from IoT devices using MQTT/HTTP (Python + FastAPI)
  • State & Cache Service: Maintains recent sensor states and alerts (Node.js + Redis)
  • Telemetry Storage Service: Stores historical sensor data and events (Java + MySQL)
  • Edge Analytics Service: Runs ML-based anomaly detection on sensor streams (Python + TensorFlow)

The company plans to deploy these services using Docker containers and Kubernetes orchestration across a cluster of edge servers located inside factories, with optional cloud connectivity.


Part A: Architecture & Design (8 marks)

A1: Microservices

Explain why a microservices architecture is more suitable than a monolithic architecture for this IoT system. Provide three specific advantages, making reference to the services listed above.
(6 marks)

A2: Edge Analytics

The Edge Analytics Service requires significantly more computational resources (CPU and memory) than the other services. Explain how the microservices architecture helps address this requirement in an IoT edge environment.
(2 marks)


Part B: Containerization with Docker (8 marks)

B1: State and Cache

For the State & Cache Service (Node.js + Redis), describe what would be included inside its Docker container. Identify at least four components that must be packaged.
(4 marks)

B2: Benefits

Explain two key benefits that Docker containers provide for deploying IoT microservices at the edge compared to traditional virtual machines.
(4 marks)


Part C: Kubernetes Orchestration (9 marks)

The company deploys its containerized IoT microservices on a Kubernetes cluster with one Control Plane and three Worker Nodes, each representing an industrial edge server inside a factory.

C1: Role

Describe the role of the following Kubernetes Control Plane components in managing IoT microservices:

  • Scheduler (2 marks)
  • Controller Manager (2 marks)

C2: Ingestion

During a production surge, thousands of machines simultaneously start transmitting high-frequency sensor data. The Device Ingestion Service experiences a 10× increase in traffic.

Explain how Kubernetes handles this situation using auto-scaling, describing what happens to the pods/containers.
(3 marks)

C3: Bug

A critical software bug is discovered in the Edge Analytics Service, and a fixed version is available in a new Docker image.

Describe how Kubernetes performs a rolling update to deploy the fix without disrupting real-time monitoring.
(2 marks)



Solution

Part A: Architecture & Design (8 marks)

A1. Advantages of microservices for an IoT system

(6 marks – 2 marks each)

  1. Independent Scaling Based on Sensor Load

    • Different IoT services experience different workloads
    • Example: The Device Ingestion Service scales rapidly during sensor bursts, while the Telemetry Storage Service scales more gradually
    • Improves resource efficiency at the edge
  2. Fault Isolation and System Resilience

    • Failure of one service does not bring down the entire IoT platform
    • Example: If the Edge Analytics Service fails, devices can still transmit data and telemetry can still be stored
    • Critical for continuous industrial operation
  3. Technology Diversity for IoT Workloads

    • Each service uses the most appropriate technology
    • Example: Redis for fast device state, MySQL for long-term telemetry
    • ML frameworks such as TensorFlow are isolated within the analytics service

Other acceptable answers:

  • Faster updates and independent deployment
  • Easier maintenance of distributed IoT services
  • Support for heterogeneous edge hardware

A2. Handling high resource requirements at the edge

(2 marks)

  • The Edge Analytics Service can be allocated higher CPU and memory independently
  • It can be scheduled on edge nodes with more powerful hardware (e.g. GPUs)
  • Prevents over-provisioning of the entire IoT system

Part B: Containerization with Docker (8 marks)

B1. Components inside the State & Cache Service Docker container

(4 marks – 1 mark each, any four)

  • Application code (Node.js service logic)
  • Node.js runtime environment
  • npm dependencies and libraries
  • Redis client libraries
  • Configuration files (ports, environment variables)
  • Minimal OS libraries from the base image

B2. Benefits of Docker containers for IoT edge deployment

(4 marks – 2 marks each)

  1. Lightweight and Resource-Efficient

    • Containers share the host OS kernel
    • Suitable for resource-constrained edge devices
    • Fast startup and recovery times
  2. Portability and Deployment Consistency

    • Same container image runs in development, cloud, and edge environments
    • Reduces deployment errors across distributed factories

Other acceptable answers:

  • Faster updates and rollbacks
  • Simplified remote management of edge nodes

Part C: Kubernetes Orchestration (9 marks)

C1. Kubernetes Control Plane components

(4 marks total)

Scheduler (2 marks):

  • Assigns pods to worker nodes based on resource availability
  • Places compute-intensive analytics pods on capable edge servers

Controller Manager (2 marks):

  • Ensures desired state is maintained
  • Automatically replaces failed pods (self-healing)

C2. Auto-scaling during sensor data bursts

(3 marks)

  • Kubernetes monitors metrics such as CPU usage or request rate (1 mark)
  • Horizontal Pod Autoscaler creates additional ingestion pods when thresholds are exceeded (1 mark)
  • Pods are distributed across edge servers and removed when load decreases (1 mark)

C3. Rolling update for Edge Analytics Service

(2 marks)

  • New pods using the fixed image are started while old pods continue running (1 mark)
  • Old pods are terminated only after new pods are healthy, ensuring uninterrupted monitoring (1 mark)