A Step-by-Step Guide: How to Deploy DDS Applications on Kubernetes
Written by Kyoungho An
May 28, 2020
Scalable Software Delivery for Your DDS Systems - Part 2 of 2
Last week in Part 1, I provided an overview of Kubernetes (k8s) and explained how it can improve software delivery in large-scale DDS systems. Today in Part 2, I would like to go through detailed instructions on how to deploy Data Distribution Service™ (DDS) applications on k8s for you to use as reference. Let’s get started!
To deploy DDS applications on k8s, you’ll first need to complete the following steps:
- Develop a build file for a Docker image.
- Build a Docker image and push it to a Docker repository.
- Develop k8s manifest files.
- Deploy containers with the k8s manifest files.
I will now walk you through each of these steps using RTI Perftest as an example DDS application (see Figure 1). We’ll assume you already have your own k8s cluster and kubectl (that can access the cluster) installed on your machine. k8s integrates multiple virtual networking solutions such as Calico, Flannel and WeaveNet as plugins and you only need to pick one of them. I picked WeaveNet because it supports multicast and therefore I did not need to configure anything for DDS discovery.
If you use other networking solutions that do not support multicast, such as Calico and Flannel, you should run Cloud Discovery Service (CDS). CDS is our experimental product that handles discovery over networks that do not offer support for multicast capabilities.
Figure 1. Kubernetes Networking Under the Hood
Step 1. Develop a build file for Docker image
FROM ubuntu:18.04 as builder
Dockerfile for RTI Perftest
Step 2. Build a Docker image and push it to a Docker repository
Run the following command to build a Docker image for RTI Perftest.
$ docker build -t DOCKER_REGISTRY_URL/rti-perftest:v3.0.1 .
After that, you can push the build image to a Docker repository.
$ docker push DOCKER_REGISTRY_URL/rti-perftest:v3.0.1
The pushed Docker image should be accessible by your k8s worker nodes.
Step 3. Develop k8s manifest files
Next, Kubernetes manifest files for RTI Perftest publisher and subscriber need to be developed.
- name: "rtiperftest-pub"
- name: "perftest_args"
Kubernetes Manifest for RTI Perftest Publisher (rtiperftest_pub.yaml)
- name: "rtiperftest-sub"
- name: "perftest_args"
Kubernetes Manifest for RTI Perftest Subscriber (rtiperftest_sub.yaml)
Step 4. Deploy containers with the manifest files and scale them up
The last step is to deploy containers with the manifest files via kubectl.
$ kubectl apply -f rtiperftest_pub.yaml
$ kubectl apply -f rtiperftest_sub.yaml
After running the commands, you can check if they are successfully deployed and running.
$ kubectl get pods
You should see something like this:
Once the pods are running, you can get the logs of a specific pod.
$ kubectl logs rtiperftest-sub-8549bc57bf-n7wnf
RTI Perftest 3.0.1 (RTI Connext DDS 6.0.0)
You can simply scale up the subscriber by running the following command.
$ kubectl scale -replica=3 deployment/rtiperftest-sub
k8s can simplify remote deployment and scaling of applications with declarative manifests. I did not demonstrate it here, but k8s can self-heal by automatically spinning up pods on healthy nodes when they fail and can also remotely perform rolling updates and rollbacks.
DDS works pretty well for pod-to-pod communications inside a k8s cluster. If you use a networking plugin supporting multicast, DDS can automatically handle discovery for your applications without relying on a stable IP address and DNS name provided by a k8s Service.
However, there are still some questions you may have when deploying DDS applications on Kubernetes, such as:
- How can we expose DDS communications outside of a k8s cluster?
- What is the performance overhead over k8s virtual networks?
- How can we replicate stateful DDS applications?
I also had these questions while exploring k8s. The good news: I will share what I learned about these topics with you in the near future. Stay tuned!
About the author
Kyoungho An is a Senior Research Engineer at Real-Time Innovations (RTI). He has 10 years of experience with distributed real-time embedded systems. His research interest includes publish/subscribe middleware, and deployment and monitoring of distributed systems. He has been leading several DOD and DOE funded research projects as a principal investigator. He has published research papers in journals and conferences focusing on distributed event-based systems, middleware, and cyber-physical systems. He holds a Ph.D. in Computer Science from Vanderbilt University.