Sunday, January 5, 2020

Cloud Devops (part 1)


The "Infrastructure as Code" movement is all very well but a just criticism is that for most people this means piles of XML and YAML - both of which are not code but mark-up languages. Fear not, there are decent alternatives.

Java programmers are spoiled by having at least two client libraries for Kubernetes. The official one is here. But there is also...


Fabric8

"Fabric8 is an integrated open source DevOps and Integration Platform which works out of the box on any Kubernetes or OpenShift environment and provides Continuous Delivery, Management, ChatOps and a Chaos Monkey." (Fabric8 FAQ)
Spark also uses the Fabric8 API in its integration tests. Its client module " provides access to the full Kubernetes & OpenShift REST APIs via a fluent [Java] DSL."

A notable feature of it is its mock Kubernetes server that allows you to write tests like this one.

Fabric8 also provide a Maven plugin that
"is a one-stop-shop for building and deploying Java applications for Docker, Kubernetes and OpenShift. It brings your Java applications on to Kubernetes and OpenShift. It provides a tight integration into maven and benefits from the build configuration already provided. It focuses on three tasks:
  • Building Docker images
  • Creating OpenShift and Kubernetes resources
  • Deploy application on Kubernetes and OpenShift" (Fabric8 FAQ)

Minikube

Although you can install and run Kubernetes on your bare metal, it may be easier to run a virtual cluster on your laptop with Minikube.
"Minikube is a tool that makes it easy to run Kubernetes locally. Minikube runs a single-node Kubernetes cluster inside a Virtual Machine (VM) on your laptop for users looking to try out Kubernetes or develop with it day-to-day." (Minikube docs)
In Spark, "the simplest way to run the integration tests is to install and run Minikube".

Upon starting Minikube with something like this:

$ minikube start --vm-driver=virtualbox

Minikube will create a VirtualBox VM, install Kubernetes on it and once done, kubectl is now configured to use "minikube".

You can also run

$ minikube dashboard

which opens the Kubernetes dashboard in your browser.

Note: you may need to run minikube delete if you change networks (say, you take your laptop to a coffee shop) and restart the Minikube cluster as this confuses it.

No comments:

Post a Comment