February 17, 2018 By IBM Instana Team 4 min read

We introduced the sample microservices application called Stan’s Robot Shop in a previous post. In this article, we’ll take you through deploying that microservice application to a Kubernetes cluster and installing the IBM Instana™ agent. Stan’s Robot Shop code already includes any extra setup, so all infrastructure technology will be automatically discovered, and every request will be traced end to end.

Sample application install

First, choose your environment. I’ll be using Google Kubernetes Engine (GKE); you may also use minikube to run everything locally on your laptop. Once you have your Kubernetes cluster running, you’re going to install the IBM Instana agent; then deploy the Stan’s Robot Shop application.

Installing and configuring Kubernetes

To work with Kubernetes, install a copy of kubectl locally on your machine. If you’re using the GKE, you’ll also need a copy of Goggle Cloud (gcloud) installed locally.

From the GKE dashboard, create a basic cluster of 3 nodes. Click the Connect button, then copy and paste the command to a shell prompt. This process will configure the kubectl command to work against your newly created cluster. Test that everything is working so far:

$ kubectl cluster-info

Great, you have a running Kubernetes cluster and you can talk to it through kubectl.

IBM Instana agent

A deployment descriptor file is included with Stan’s Robot Shop code. You can download it through git:

$ git clone https://github.com/instana/robot-shop

If you don’t have git installed, go to the GitHub page and click the Download link on the top right. This step will download a zip file; expand it into a directory.

Under the Stan’s Robot Shop project directory, there’s a subdirectory named instana. This subdirectory is where you’ll find the YAML file that describes the agent deployment. You’ll need to edit it to configure your unique agent key, which must be Base64 encoded. Get your unique agent key from the IBM Instana dashboard under Management Portal:

$ echo -n “your unique agent key” | base64

Save the changes to the deployment. Then deploy the agent:

$ kubectl create -f instana-agent.yaml
namespace "instana-agent" created
serviceaccount "instana-admin" created
secret "instana-agent-secret" created
daemonset "instana-agent" created

The agent is deployed as a DaemonSet in its own namespace and configured to only run on nodes with the label agent=instana. There’s a helper script label.sh, which will label all nodes.

$ ./label.sh

The agent will take a moment or two to start and then report into the IBM Instana backend, after which it will appear in the IBM Instana dashboard:

Excellent work. The IBM Instana dashboard is showing the empty Kubernetes cluster. Although we haven’t yet deployed the Stan’s Robot Shop application, you can see that the IBM Instana agent has already discovered a number of running containers, which are system containers like system processes of an operating system.

Stan’s Robot Shop: Sample microservices application

All the deployment and service definition files for deploying the Stan’s Robot Shop to Kubernetes are included in the source under the K8s directory.

If you’re using the GKE, edit the deployment file for the web service: K8s/web-service.yaml

Change the type from NodePort to LoadBalancer. No changes are required if you’re using minikube.

apiVersion: v1
kind: Service
metadata:
  annotations:
    kompose.cmd: kompose convert -f ../docker-compose.yaml
    kompose.version: 1.8.0 (0c0c027)
  creationTimestamp: null
  labels:
    io.kompose.service: web
  name: web
spec:
  type: LoadBalancer
  ports:
    - name: "8080"
    port: 8080
    targetPort: 8080
    nodePort: 30080
  selector:
    io.kompose.service: web
status:
  loadBalancer: {}

Create a separate namespace to put the application in and deploy the application:

$ kubectl create namespace robot-shop
$ kubectl -n robot-shop create -f K8s

It will take a few minutes for Kubernetes to download all the images and create the pods to start running the application. As the pods are created and the images start running, the IBM Instana agent will automatically discover them and dynamically load the matching sensor to start monitoring the technology. You can watch this process happen in real time on the IBM Instana infrastructure dashboard.

If you’re running through minikube, Stan’s Robot Shop will be available through the IP address of your minikube instance.

$ minikube ip

The above command will print out the IP address of your minikube instance; open your browser http://<minikube ip>:30080/

If you’re using the GKE, select Discovery & load balancing from the left menu, and then click on the web service. This step will bring up the service details.

Click the External endpoints link to open the shop in your browser. You’re an APM rock star now. You have just deployed a modern containerized microservices application with Kubernetes—with full monitoring. Don’t tell your boss how easy it really is with the IBM Instana platform; you’ll shatter the illusion.

Sample application load generation

You can click around the application to generate some traffic through the application—don’t worry you’ll not actually purchase anything. There’s also a separate load generation utility under the load-gen directory. It runs locally through a Docker image: edit load-gen.sh and set the environment variable HOST to the URL of your deployed shop, save and run the script.

As some load is put through the application, the IBM Instana platform will automatically trace every request end to end and build the service map.

Conclusion

Monitoring a modern containerized, orchestrated microservices application isn’t that difficult when you have Stan helping you. Watch for future posts when we cover topics such as end-user monitoring (EUM) and integrating OpenTracing spans.

Get started with IBM Instana and sign up for the free trial
Was this article helpful?
YesNo

More from IBM Instana

Probable Root Cause: Accelerating incident remediation with causal AI 

5 min read - It has been proven time and time again that a business application’s outages are very costly. The estimated cost of an average downtime can run USD 50,000 to 500,000 per hour, and more as businesses are actively moving to digitization. The complexity of applications is growing as well, so Site Reliability Engineers (SREs) require hours—and sometimes days—to identify and resolve problems.   To alleviate this problem, we have introduced the new feature Probable Root Cause as part of Intelligent Incident…

Observe GenAI with IBM Instana Observability

6 min read - The emergence of generative artificial intelligence (GenAI), powered by large language models (LLMs) has accelerated the widespread adoption of artificial intelligence. GenAI is proving to be very effective in tackling a variety of complex use cases with AI systems operating at levels that are comparable to humans. Organisations are quickly realizing the value of AI and its transformative potential for business, adding trillions of dollars to the economy. Given this emerging landscape, IBM Instana Observability is on a mission to…

Average 219% ROI: The Total Economic Impact™ of IBM Instana Observability

2 min read - What can your organization achieve with a modern observability solution? Data from a new Forrester Consulting study showed that a composite organization that used the IBM Instana™ Observability platform achieved a 219% ROI over three years. Likewise, it saw a 90% reduction in troubleshooting time by providing high fidelity data to the right people at the right time. About the study IBM commissioned Forrester to conduct the Total Economic Impact™ (TEI) study by interviewing four clients about the value of their…

IBM Newsletters

Get our newsletters and topic updates that deliver the latest thought leadership and insights on emerging trends.
Subscribe now More newsletters