This project simulates a 5G-Powered Smart City Transit System, consisting of three microservices:
- IoT Ingestion Service: Ingests IoT data from public transportation systems.
- Prediction Service: Analyzes IoT data to predict traffic congestion.
- E2 Interface Service: Manages communication with 5G base stations, handling network slicing for public transport.
The system is containerized using Docker and orchestrated using Kubernetes. The project uses Kafka for message brokering between services and Zookeeper for managing Kafka clusters.
You can view and contribute to the project repository on GitHub:
5G-Powered Smart City Transit System Repository
5G HACKATHON/
│
├── deployments/ # Kubernetes deployment files
│ ├── e2-interface-deployment.yaml # Deployment file for E2 Interface Service
│ ├── iot-ingestion-deployment.yaml # Deployment file for IoT Ingestion Service
│ └── prediction-service-deployment.yaml # Deployment file for Prediction Service
│
├── services/ # Service code and Dockerfiles
│ ├── e2_interface_service/
│ │ ├── e2_interface_service.py # E2 Interface Service code
│ │ └── Dockerfile # Dockerfile for E2 Interface Service
│ ├── iot_ingestion/
│ │ ├── iot_ingestion.py # IoT Ingestion Service code
│ │ └── Dockerfile # Dockerfile for IoT Ingestion Service
│ └── prediction_service/
│ ├── prediction_service.py # Prediction Service code
│ └── Dockerfile # Dockerfile for Prediction Service
│
├── docker-compose.yml # Docker Compose configuration for Kafka & services
├── requirements.txt # Common dependencies for all services
└── README.md # Project documentation
- This service collects real-time location and capacity data from IoT devices (like buses, trains, and metro systems).
- Data is then sent to Kafka for further processing.
- The service is exposed externally using NodePort.
- The Prediction Service consumes data from Kafka and uses a machine learning model to predict whether the traffic is crowded or not crowded.
- Once a prediction is made, it is sent back to Kafka for further use by the E2 Interface Service.
- The E2 Interface Service consumes the prediction data from Kafka.
- Based on the predictions, the service communicates with the 5G base station to manage network slices using mMTC and URLLC technologies.
- If traffic is crowded, it allocates high-priority slices like URLLC; if not crowded, it only uses mMTC.
Clone this repository to your local machine:
git clone https://github.com/your-repository/itu-5g-hackathon.git
cd itu-5g-hackathon
You need to build Docker images for each service (IoT Ingestion, Prediction, E2 Interface). Each service has its own Dockerfile located in its respective directory.
-
Build IoT Ingestion Service:
docker build -t your-dockerhub/iot-ingestion:latest -f services/iot_ingestion/Dockerfile .
-
Build Prediction Service:
docker build -t your-dockerhub/prediction-service:latest -f services/prediction_service/Dockerfile .
-
Build E2 Interface Service:
docker build -t your-dockerhub/e2-interface-service:latest -f services/e2_interface_service/Dockerfile .
Push each service's Docker image to your Docker Hub account:
-
Push IoT Ingestion Image:
docker push your-dockerhub/iot-ingestion:latest
-
Push Prediction Service Image:
docker push your-dockerhub/prediction-service:latest
-
Push E2 Interface Service Image:
docker push your-dockerhub/e2-interface-service:latest
Use the Docker Compose file to bring up Kafka and Zookeeper:
docker-compose up
This will start Kafka and Zookeeper, which are needed for message brokering between the services.
Once you have the Docker images ready, apply the Kubernetes deployment files for each service.
-
Deploy IoT Ingestion Service:
kubectl apply -f deployments/iot-ingestion-deployment.yaml
-
Deploy Prediction Service:
kubectl apply -f deployments/prediction-service-deployment.yaml
-
Deploy E2 Interface Service:
kubectl apply -f deployments/e2-interface-deployment.yaml
Since the IoT Ingestion Service is exposed using NodePort, you can access it using the external IP of your Kubernetes node and the NodePort (30001 in this case).
To get the external IP:
kubectl get nodes -o wide
Then access the service at:
http://<node-external-ip>:30001
Once deployed, the services will communicate via Kafka:
- IoT Ingestion Service will send data to Kafka.
- Prediction Service will consume data from Kafka, run predictions, and send results back.
- E2 Interface Service will consume the prediction results and communicate with the 5G base station to allocate network slices accordingly.
-
Check Logs for a Specific Service:
kubectl logs <pod-name> -f
-
Scale Up or Down a Service:
kubectl scale deployment <deployment-name> --replicas=<number>
This project simulates how a 5G-powered smart city transit system can handle public transportation data, predict traffic congestion, and dynamically manage network resources using advanced 5G technologies such as mMTC and URLLC.
For any issues or further clarifications, please refer to the documentation or reach out to the project contributors.