订阅内容

The response to Stan’s Robot Shop, Instana's sample containerized microservice application, has been fantastic – and when we wrote a primer on deploying Instana’s sample microservice application on Kubernetes, users ate it up.

So let’s talk OpenShift. If you didn’t catch our blog about managing OpenShift application performance with Instana, it’s worth a read.

As a Prime Red Hat partner, Instana has published several informational blog posts, including a discussion on Red Hat OpenShift basics and publishing a sample microservices application called Stan’s Robot Shop. This article outlines the steps for deploying the Robot Shop sample microservice application on OpenShift.

OpenShift Prerequisites for Microservices

Red Hat offers OpenShift as a managed container service, but this exercise uses minishift, which allows you to run a small OpenShift cluster on your laptop. I run minishift with Virtualbox, but other options are available. To see the performance results, you will also need an Instana account (if you don’t have one, you can sign up for a free Instana trial).

Installing Your Sample Microservices Application on OpenShift

To start you will need Stan’s Robot Shop code:

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

If you don’t have git installed, simply go to the Stan’s Robot Shop repository and select the download link on the top right of the page to get a zip file of the code.

Fire up minishift and open its console so you can see what is going on.

$ minishift start --vm-driver virtualbox
$ minishift console

This will start a small OpenShift cluster with 2 CPU and 2GB of memory, which is plenty to run Stan’s Robot Shop. Login to the console with the account “developer” using anything except blank for the password – no check is performed. In a different browser tab, open your Instana dashboard Infrastructure Map.

Since OpenShift is built on Kubernetes, we could just use the regular kubectl commands, but this would miss out on the extra automation features of OpenShift. The OpenShift equivalent of kubectl is oc, set this up:

$ eval $(minishift oc-env)

Next, we install the Instana agent on the cluster. You will find helper scripts under the OpenShift directory of the code you previously downloaded. Before running the script, edit the instana-agent-os.yaml file and set secret key to base64 encoded agent key. You will find the agent key under Management Portal, accessible from the drop down menu at the top right of your Instana dashboard. The Agent Key is displayed after selecting Agent Key on the Management Portal home page.

$ echo -n "your agent key" | base64
$ cd OpenShift
$ ./agent-deploy.sh

The “instana-agent” project is created on the OpenShift dashboard and after a minute or two you will see your OpenShift cluster appear on the Instana dashboard.

The Instana agent has already discovered some containers running on the minishift virtual host, these are OpenShift, Docker registry and HA-Proxy. Congratulations you now have a running OpenShift environment fully monitored by Instana, you are on your way to microservice nirvana.

OpenShift has its own Docker registry that is used to stage images before they are deployed as applications. A Docker image is imported into this registry then a deployment or application is made from this image. By linking the two together updating the image in the local OpenShift registry automatically updates the deployment or application. The script used to deploy Stan’s Robot Shop uses this method of automation.

$ ./deploy.sh

After running this script, the robot-shop project will appear in the OpenShift dashboard. Drill into this project, Applications -> Pods, here you will be able to watch the Pods being created and started, it will take a few minutes to complete.

Once all the Pods are running, goto Applications -> Services and select the web service. To make this service externally available change the type from ClusterIP to NodePort and define the port as 30080. Select Actions drop down at the top right then select Edit YAML.

Stan’s Robot Shop is now available on port 30080 of the minishift IP address

$ minishift ip

Navigate to http:// :30080/

Now you can click about and generate some load. Meanwhile over on the Instana dashboard, the agent will have automatically discovered all those new containers and started monitoring them.

As you generate some load every request is traced end to end and the service map is automatically built.

Monitoring Your Sample Microservice Application on OpenShift

Monitoring OpenShift with Instana is very easy.

You have reached microservice monitoring Guru status and achieved a Zen like inner peace not having to worry about how your application is performing. What are you going to do with all the time you have just got back?

In future posts I will cover End User Monitoring, application troubleshooting and other container orchestration systems. Stay tuned.


关于作者

UI_Icon-Red_Hat-Close-A-Black-RGB

按频道浏览

automation icon

自动化

有关技术、团队和环境 IT 自动化的最新信息

AI icon

人工智能

平台更新使客户可以在任何地方运行人工智能工作负载

open hybrid cloud icon

开放混合云

了解我们如何利用混合云构建更灵活的未来

security icon

安全防护

有关我们如何跨环境和技术减少风险的最新信息

edge icon

边缘计算

简化边缘运维的平台更新

Infrastructure icon

基础架构

全球领先企业 Linux 平台的最新动态

application development icon

应用领域

我们针对最严峻的应用挑战的解决方案

Original series icon

原创节目

关于企业技术领域的创客和领导者们有趣的故事