Skip to Content
Technical Articles
Author's profile photo Nabheet Madan

#HelloWorld SAPUI5 meets Kubernetes – Containers meet Orchestrators

All Blogs in the series


Now in our previous blog we have seen how we have packaged our SAPUI5 Hello World app inside an image and pushed to docker hub. In this blog we will be going a step further. Consider a scenario you have N number of containers running, how do we manage their end to end lifecycle easily. Of course we can do it via cli but it will be a big time consuming task. So what we need is something which can take care of this cycle which is nothing but an orchestrator like Kubernetes or in short k8s. So kubernetes actually helps in maintaining the end to end lifecycle of containers, refer this blog to understand the basics.  Lets’s try to use Kubernetes in managing our containers. Please note that docker also has its own orchestrator docker swarm or 3rd party like Meso’s, but we will be focussing on k8s.

What we will do now?

K8s also follows a declarative approach like others. All we need is yaml file and describe what all we need to deploy. So we have our image available all we need is to use k8s to create and manage the containers.  K8s has concept of pod’s which is nothing but collection of homogenous containers. For example you have a frontend application with a mysql database then you can create two containers one for DB and another for our frontend they are binded together as one pod.

image source

What we will do is we will create a deployment where we will describe how many pods, which images etc. we need to get our system up and running.

Let’s create a deployment

Before actually starting, we need to install minikube on to our system, this is for testing and learning purposes. Of course a productive version will need a better hardware spec. Please check this step by step guide to install the same.Once minikube is installed lets start it.

minikube start

Creating a deployment. As can be seen below we are mentioning the kind as deployment, 4 replicas meaning 4 pods containing container of the mentioned image. Don’t forget to mention the tag with the image else the pod creation will fail.

apiVersion: extensions/v1beta1
kind: Deployment
  name: ui5
  replicas: 4
        app: ui5
        - name: ui5
          image: nabheetmadan/helloworldui5:1.0
          - containerPort: 80

Use the below command to create the deployment

kubectl create -f webserverui5.yaml

Check all what has been created or running in the node using below command. As can be seen in screen shot we have 4 pods running along with one deployment and one service. What is a service read on!

kubectl get all

What the heck is a service?

Now we have multiple pod’s running on a node how do they communicate among themselves as well to the external world, it is via Services.  Of course we will not want to expose everything to the external world for example database, so what k8s does is, it provides two type of services one is Nodeport which to expose to the external world another is clustered ip type which is used to communicate internally with pods. So lets create a service for our hello world application.

We are defining kind as service and type as Nodeport we are exposing the port 80. Important thing is how will it know which deployment it has to map to it is via selector(labels and tags) which is ui5 in our case.

apiVersion: v1
kind: Service
        name: ui5svc
                run: ui5svc
        type: NodePort
                - port: 80
                  protocol: TCP
                  app: ui5   

Lets create the service

kubectl create -f ui5svc.yaml

Checking what all is created, we can see a service is also created with port 30627.

Access this service

minikube service ui5svc

We can see our app running on Kubernetes

What is next?

So far we have covered the cycle of creating the docker image, publishing it to docker hub and then deploying it via Kubernetes. We have taken the first steps plan is to extend this app and explore other k8s features, learn and share. Feel free to provide your feedback!.

Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Mahesh Palavalli
      Mahesh Palavalli

      Thanks for the detailed step by step guide Nabheet Madan !!  I've seen a topic sometime back where they talk about interaction between different containers by making a big application as micro services.. which is very exciting..

      Got to try your blogs first to check them out 🙂

      Author's profile photo Nabheet Madan
      Nabheet Madan
      Blog Post Author

      Thanks for the feedback. Yes as of now we have one pod with one container running. Next plan is to add two more more on micro service pattern:)


      Author's profile photo Jakob Marius Kjær
      Jakob Marius Kjær

      Excellent that you got to blog about it. Very inspiring.

      Would be great with a bit more info of why kubernetes makes sense in regards to scalability and deployment for example on cf or other cloud platforms like aws or azure.

      Author's profile photo Nabheet Madan
      Nabheet Madan
      Blog Post Author

      Thanks for the feedback. I am on learn and explore mode:) will try to share my experience/viewpoint as we make this application bit complex(showcasing scalability) with a backend and all..

      Author's profile photo Sha Khan
      Sha Khan

      Great efforts and Good article. I like it. Thanks for sharing it with us.