Development / Kubernetes / Technology

Tutorial: Deploy Microservices on Kubernetes Through Rudr

23 Oct 2019 10:02am, by

The Open Application Model (OAM) specification defines how to compose modern applications as microservices. Launched last week, Rudr is a reference implementation of OAM from Microsoft targeting Kubernetes.

Applications targeting Rudr have three elements: Components, Configuration, and Traits:

  • Components define one or more container images targeting an OS and their hardware requirements such as CPU, RAM, and storage.
  • Configuration deals with runtime parameters such as environment variables.
  • Traits declare runtime attributes such as volumes, ingress, and scaling.

In this tutorial, we’ll explore the concepts of Rudr by mapping an existing app to the OAM specifications. We will take an existing containerized web application, model it for Rudr, and deploy it on Kubernetes running in Minikube. Rudr is a collection of Kubernetes CRDs that map the OAM artifacts to Kubernetes objects. Make sure you have kubectl installed on your machine.

You can build the container from the source code available on this GitHub repository. But you can try this tutorial by using the public image that I already pushed to Docker Hub.

The node.js-based web application and MongoDB container images are Components of our deployment. The MongoDB connection string sent as an environment variable forms the simple Configuration. Finally, we will configure ingress as a Trait.

Before going ahead, install the Ingress addon on Minikube.

Installing Rudr

We will start by deploying Rudr Helm Chart. Download the latest beta of Helm3 and add it to the path. Note that Helm3 doesn’t have Tiller running as the server.

Clone the Rudr repo that has the Helm Chart and install it.

You can verify the installation by checking the CRDs and the Pod.


Declaring the Rudr App Artifacts

We will now create the definition of two components from the MongoDB container image and the web container image. The node.js container image is a simple todo app based on the Express framework which stores the tasks in MongoDB.

Let’s call these components backend and frontend.

The first interesting aspect about the above definitions is the workload type. Since both are long-running processes listening on a specific port, they are defined as Server. But MongoDB container is always run as a single Pod, which translates to SingletonServer.

The node.js web app checks the environment variable DB which if found empty will be populated with string “db”. The web app declaration contains the parameters section followed by the env section that retrieves the value defined in the database parameter.

Both components have the ports mentioned in the declaration.

This artifact is expected to be created by the developers as a part of the build process.

Once the ComponentSchematic is in place, we will define the Configuration and Traits.

The above configuration does two important things — defining the instance name for each component and setting the environment variable expected by the web app. Next, it defines the ingress rule for accessing the web application.

It’s time to deploy the Components, Configuration, and Traits.


This operation doesn’t result in the creation of Kubernetes Pods. The deployment takes place only when the Rudr Configuration associated with the Components is deployed.

Let’s submit the Configuration to Kubernetes.


The Pods will now get deployed. The default Namespace has three Pods – rudr, frontend, and backend.

Since the Configuration has the definition of an Ingress, the Pods and Service belonging to the web app are associated with the Ingress.

To access the web application from the browser through the Ingress, add the IP address of the Minikube to /etc/hosts file.

We are now ready to access the app by visiting the URL todo.example.com.

Janakiram MSV’s Webinar series, “Machine Intelligence and Modern Infrastructure (MI2)” offers informative and insightful sessions covering cutting-edge technologies. Sign up for the upcoming MI2 webinar at http://mi2.live.

MongoDB is a sponsor of The New Stack.

Feature image by Alexas_Fotos from Pixabay.

A newsletter digest of the week’s most important stories & analyses.

View / Add Comments

Please stay on topic and be respectful of others. Review our Terms of Use.