forge for fast build/deploy for kubernetes (with minikube)

Just came across a nice dev tool to build and deploy Docker’ized applications. A developer may want to independently build/deploy to a local docker container or another Kubernetes cluster vs. waiting for a remote CI/CD process to deploy to a dev environment. This involves some repetitive tasks such as building the binary, packaging into a Docker container, pushing to a Docker registry and all the way to deploying to a running container. If you run this often it can be a time suck for developers. forge.sh takes away those repetitive steps and lets you build/deploy locally or to another cluster.

To get this setup run through following…

  1. Install and run Docker (of course) — https://www.docker.com/community-edition
  2. Create a docker hub account — https://hub.docker.com/
  3. Install kubectl — https://kubernetes.io/docs/tasks/tools/install-kubectl/
  4. Install minikube — https://github.com/kubernetes/minikube
  5. Download sample project from forge.sh or from my github repo — https://github.com/thomasma/quote-service-docker
  6. Install forge.sh — http://forge.sh/

Build the maven project which generates a Spring Boot deployable jar.

mvn clean package
forge deploy

You should see forge build the docker image and deploy the service. The latest release skips image builds if there were no changes.To get the endpoint URL for the service on minikube…

$ minikube service --url quote-service
http://192.168.99.100:32336

The URL above is what I got on my local machine. Yours will be different. Hit that URL with request path

curl http://192.168.99.100:32336/quotes/

You will get some random Chuck Norris joke in JSON format. The service goes out to a 3rd party API to get the jokes. If you dont see a joke then run it a couple of times (a bug).

To get the convenience of quick build/deploy you need to provide a few configuration files (hey nothing in life comes free).

  • service.yml — contains service metadata
  • forge.yml — connection information to your Docker registry (in my case docker hub). This file is sensitive to your account so I have not added it into my github project.
  • k8s/* — deployment templates

Forge.sh provides a great overview at http://forge.sh/discussion/how-it-works.html

end.


One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.