Monitoring a PVC in Kubernetes with Prometheus
Something that I believe is a quite normal use case is that you’d want to monitor a Persistent Volume Claim (PVC) in kubernetes, to make sure that you get notified once you start running out of disk space. As a concept it sounds like something that should be supplied out of the box from Kubernetes, alas no.
Let’s say that you have an application that runs in Kubernetes. Now, for whatever reason, you want to test running this application on your local machine. Maybe you even want to build a local docker image and test how that works. But let’s say that your service depends on another service in Kubernetes. Now you have a problem. You can’t start your service because it won’t be able to find the other service that is living in Kubernetes. You’ll be happy to find that circumventing this problem is not very difficult.
Caching in Quarkus
Caching in itself doesn’t feel like a very complicated problem. You make some request, you save the result, and at some point you clear it again. Everytime I’ve had to use caching in the past though, I’ve always found the libraries more clunky and invasive than I’ve felt that they need to be.
Vertx and Eventbus
Vertx uses an Eventbus, which is a neat way of decoupling different components inside a system. Instead of these components calling each other directly they simply send a message on the event bus and whatever system that is interested receives the message. The idea is pretty simple and not really a new one. There is a limitation though. Vertx has been built with cluster support at it’s core.
Intellij on Ubuntu
The default mode of installing Intellij on Ubuntu seems to be as a Snap. There are definitely some advantages there, for example how easy it becomes to update the intellij version. What sometimes happens with Snaps though, which unfortunately was the case for me, is that they take a long time to startup.
Quarkus, Netty and OpenSSL
Quarkus is built on top of Netty which is a library that can provide you with high performant asynchronous network code on JVM. One of the features that Netty supports is SSL termination. Now SSL, being cryptography, is actually quite demanding on the processor. For this reason Netty has provided two solutions. One that is using the JDK implementation for SSL and one that is utilizing JNI to call OpenSSL on your machine.
Mocking and Kotlin
One of the good things with Kotlin is it’s accessible interoperability with Java. Being a new language though it has made some design decisions that are different from Java’s which sometimes can create boundaries in the usage across language boundaries and one of these decisions is what I want to talk about today.
Kotlin Extension Methods
If you’ve worked for a while with
Java and then take the step into
Kotlin, it is easy to keep on writing code like you used to do it in
Java but just using
Kotlin’s more succinct syntax. That’s also a very good first step to getting into the world of
Kotlin. Once you’ve gotten some experience there’s one feature I really advice you to adopt. That’s the Extension Methods.
Quarkus and Randomness
Quarkus is a project in the
JVM world which enables you to write “Supersonic Subatomic Java” programs. When one first starts looking into the project it can feel a bit fuzzy what it actually does. The end result though is pretty clear, you get java application that have a significantly smaller memory footprint and that startup a lot faster. These are two features that makes Quarkus great for the Native environment where you typically want you applications to be able to scale up and down quickly and not take more resources than necessary.
Just Do It?
Are you the kind of developer that likes to know everything up front? Or are you the kind that like to just start hacking away at a problem and see where it takes you?