SunSpec Client Deployment Task
This is the final tutorial in the deployment sequence. Your goal is to deploy the sunspec-client application, which serves two purposes: it reads data from the inverter's Modbus port to verify the end-to-end data flow, and it exposes a web dashboard so you can visualize the data in real-time.
This task will teach you how to deploy a client application that connects to another service using its external NodePort address and how to expose a web UI from a Kubernetes deployment.
In this tutorial, you will be tasked to:
Deploy a client application that runs on a specific node (
agx).Configure the client with the IP address and NodePort of the inverter service.
Create a
NodePortservice to expose the client's web dashboard.Access the web dashboard in your browser to confirm the entire pipeline is working.
Before you start
Make sure that:
All previous components (Zookeeper, Kafka, Streamer, and Inverter) are deployed and running successfully.
You are SSHed into the
k3smainnode and have switched to the shared user account.
Part 1: Create the SunSpec Client Deployment Manifest
Your first goal is to create the deployment file sunspec-client-deployment.yaml.
Deployment Requirements
The SunSpec Client instance must be configured with the following specifications:
Deployment Name: The deployment must be named
sunsclient.Node Affinity: The pod must be scheduled to run on the node named
agx.Container Image: Use the
ghcr.io/decsresearch/c2sr-bootcamp-sunspec-client:latestimage.Image Pull Secret: Reference the
ghcr-pull-secret.Environment Configuration: This configuration is critical for connecting to the inverter.
KAFKA_HOSTandKAFKA_PORT: Set tokafka-serviceand9092respectively.NODE_NAME: A logical name for the client, set toagx.INVERTER_IP: The IP address of thenanonode where the inverter is running. You will need to find this IP address and hardcode it.NODE_IP: Dynamically set to the IP of the host node (agx) where this pod is running.agx: A mapping variable, set tonano.INVERTER_PORT: The port to connect to. This must be theNodePortof the inverter service, which is30502.
Skeleton File for Deployment
Create a file named sunspec-client-deployment.yaml and fill it out according to the requirements.
Part 2: Expose the Client's Dashboard with a Service
To view the data being read by the client, you need to expose its web dashboard.
Service Requirements
The Service must:
Have the name
sunsclient-dashboard-service.Be of type
NodePort.Expose the dashboard's TCP port
8050and map it to a staticnodePortof30080.Use a selector to correctly identify the SunSpec client pod (
app: sunsclient).
Skeleton File for Service
Create a second file named sunspec-client-service.yaml and complete the skeleton below.
Part 3: Final Verification
Once both YAML files are created, apply them and perform the final check by accessing the web dashboard.
Apply the manifests:
kubectl apply -f sunspec-client-deployment.yamlkubectl apply -f sunspec-client-service.yamlVerify the deployment:
kubectl get pods -l app=sunsclient -o wide(Confirm it is running on theagxnode).Check the logs: The logs should indicate a successful connection to the inverter.
kubectl logs -f <pod name>Access the Dashboard: Open a web browser and navigate to the IP address of the
agxnode on port30080. URL:http://<IP-of-agx-node>:30080
If you can see the dashboard and it is displaying changing data, you have successfully deployed the entire pipeline!