In this blog get-prometheus-metrics-from-a-express-js-app, I exposed the metrics from an Express.js app to Prometheus. Now I am going to use these metrics in Grafana.

Install Grafana

Create a new project

oc new-project grafana

We can use the OperatorHub in Red Hat Openshift to install the Grafana-operator. …

Expose the metrics in Express.js app

I use Prometheus all the time for metrics and alert monitoring in Kubernetes. I decided to see how to setup monitoring in a Node/Express.js app. A quick search of npmjs and I found these two package prom-client a really detailed Prometheus client and express-prom-bundle which uses prom-client under the hood…

First what is meant by by Identity provider? it’s allowing a third party to handle your authentication to your application like Facebook, Github or Linkedin see Keycloaks supported list below in image.

Wrote this Debug Kubernetes Operator-sdk locally in Goland last year before the first major release of the Operator-sdk. Due to changes in the Operator-sdk it’s not valid for version v1.0.0 and greater.

Here are the steps to get debug running with v1.0.0

  • In Goland go to Run\Edit Configurations
  • Select Go Build\+
  • Give the configuration a name
  • In Files add the path to main.go

In Environment add WATCH_NAMESPACE=your-operators-namespace

Wrote this some time ago debug-kubernetes-operator-sdk-locally-using-vscode but due to changes in the Operator-sdk it’s not valid for version v1.0.0 and greater.

Here are the Steps to get debug running with v1.0.0

  • Go to Run\Add Configuration
  • Select Go from environments
  • Select Go Launch package

You should get the following launch.json

{
“version”: “0.2.0”,
“configurations”: [
{
“name”: “Launch Package”,
“type”: “go”,
“request”: “launch”,
“mode”: “debug”,
“program”: “${workspaceFolder}”
}
]
}

Add an env for WATCH_NAMESPACE in the configuration so it looks like

{
“version”: “0.2.0”,
“configurations”: [
{
“name”: “Launch Package”,
“type”: “go”,
“request”: “launch”,
“mode”: “debug”,
“program”: “${workspaceFolder}”
"env": {
"WATCH_NAMESPACE": "your-operator-namespace",
}
}
]
}

Debug should now work as expected

At some stage in development of a high availability application you will want test what happens when an Availability Zone goes down in AWS.

Disabling AZ

Blocking all network traffic to AZ seems the best way to simulate this. The method I used was to change the ACL for all the subnets…

I wanted to learn how to create a rest Api with Golang and MongoDb, found a lot of tutorials using the mgo library but as this was unmaintained. I used the Mongo driver instead with gorilla/mux. First set up package and imports.

Setup the routes and Mongo db connection

I was asked a question around how to change the theme in the Keycloak docker image and I had never tried it. So it was worth a blog. First pull the original image

docker pull jboss/keycloak

Then start the image

Login to the container with the CONTAINER ID

docker…

What’s jq ?

A command line parser for json that can be downloaded here or you can use the playground. I will use this local json file as an beginner example hello-world.json

Using jq

Simplest use case is to render the whole json file and pretty print it

A couple of git aliases for git log pretty print. Add them to your .zshrc or .bashrc for usage and source the file e.g. source ~/.zshrc , or restart your terminal for the changes to apply.

gitp — pretty print the last 10 logs

Austin Cunningham

Full Stack Software Engineer at Red Hat https://austincunningham.ddns.net

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store