I have been working to put together tutorials and operation how to deploy and manage the ROS / ROS 2 fleet using Kubernetes with sample yaml description and tutorials including installation, building multi-arch container images and Kubernetes deployment.
The following is still W.I.P, I will add more examples and useful sample description for Kubernetes.
as example, you can see how to deploy the following ROS fleet via Kubernetes.
How to install and setup Kubernetes Cluster in local environment.
How to build ROS / ROS 2 container images multi-arch supported.
Example deployment yaml files to start ROS / ROS 2 fleet.
How to enable and bind CNI VxLAN to container runtime.
Managing node label to deploy the specific application container to specific physical node.
Taking advantage of DNS provided Kuberentes so resolve the node name dynamically. (means that we can deploy rosmaster or discovery server anywhere we want.)
More coming, issues are welcome (doing this best effort in my personal spare time…)
if you are interested in this, please reach out to me. I will add more examples and would like to know the use cases and problems.
This example deploys ROS 2 application pods to any available nodes in the cluster, since we do not set the nodeselector , Kubernetes decides where to deploy the application container based on statistics from the system.
This sample description starts deployment multiple application pods for each cluster node.
Application containers in each pod will only start communication in localhost only with ROS_LOCALHOST_ONLY=1 environmental variable which is bound to application container runtime.
This section it will deploy the ROS 2 application containers with host network interface.
And taking advantage of Kubernetes ConfigMap (Shared virtual storage) to bind ROS 2 specific environmental variable via initializing container runtime.
After ConfigMap is created, in the yaml description, we can use those key-value content as environmental variables for ROS 2 containers, here it uses ROS_DOMAIN_ID and RMW_IMPLEMENTATION to have logical partition and different RMW implementation support.
The advantage of this example is to isolate configuration data and runtime container completely, so that we can bind any configuration data to any container runtime when starting the deployment.