Repo for using k3s with ROS2
- Build the workspace:
colcon build --symlink-install- Source the ROS2 workspace:
source install/setup.bash- Run the CLI tool:
ros2 run ros2_k3s_cli cli --helpInteractively create a robot pod YAML config:
ros2 run ros2_k3s_cli cli create-config --output robot_pod_generated.yamlYou will be prompted for name, image, command, namespace, and can select deployment (edge/local) using arrow keys.
- Initialize cluster as server:
ros2 run ros2_k3s_cli cli init --server
- Initialize cluster as agent:
ros2 run ros2_k3s_cli cli init --agent --token <your-token> --url <server-url>
-
Interactive mode - Browse namespaces, pods, and view logs:
ros2 run ros2_k3s_cli cli get
This will:
- Show all namespaces and let you select one using arrow keys
- Display all pods in the selected namespace in a table format
- Let you select a pod using arrow keys
- Show the logs from the selected pod (last 5 seconds)
-
Get all namespaces:
ros2 run ros2_k3s_cli cli get namespace
-
Get pods in a specific namespace:
ros2 run ros2_k3s_cli cli get pod -n <namespace>
- Validate cluster config:
ros2 run ros2_k3s_cli cli validate --config cluster.yaml
- Apply (deploy) application:
ros2 run ros2_k3s_cli cli deploy --config src/ros2-k3s/examples/ros2_sub.yaml
Replace <your-token>, <namespace>, cluster.yaml and the config path with your actual values and configuration files.
A modern NiceGUI-based dashboard is now available for cluster monitoring:
- Cluster Overview: View namespaces, nodes, and cluster status in a modern UI
- Node Status: See real-time node health (Ready/NotReady/Unknown)
- Namespace Browsing: Click namespaces to view running pods
- Pod Details: See pod status, container readiness, creation time, and assigned node
- Resource Monitoring: View live CPU and RAM usage for ready pods; refresh metrics on demand
- Accurate Pod Health: Pods are only considered healthy if all containers are ready
- Visual Feedback: Color-coded status, warnings for non-ready pods, and error handling
To run the dashboard:
ros2 run ros2_k3s_web web_app