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/
    • Great Quickstart tutorial at http://forge.sh/tutorials/quickstart.html
    • Move into your project folder and execute forge setup to configure a few things.

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

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…

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

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 thought on “forge for fast build/deploy for kubernetes (with minikube)

  1. Richard Li

    Thanks for posting! (one of the forge folks here). would love to chat and see how well it’s working for you and share some of the stuff we’re working on to get your thoughts?

    Reply

Leave a Reply