Skip to content
docker and kubernetes example for https://github.com/kataras/iris
Go Shell Dockerfile Makefile
Branch: master
Clone or download
Latest commit f704922 Nov 7, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
api fix #2 Nov 7, 2019
.gitignore fix #1 ... Mar 5, 2018
Dockerfile fix #2 Nov 7, 2019
Makefile update for iris version 12 Oct 28, 2019
README.md update for iris version 12 Oct 28, 2019
go.mod update for iris version 12 Oct 28, 2019
go.sum fix #2 Nov 7, 2019
k8s-deployment.yml update for iris version 12 Oct 28, 2019
marathon.sh docker and kubernetes showcase 🚢 Jul 10, 2017
microservice.go update for iris version 12 Oct 28, 2019
wercker.yml update for iris version 12 Oct 28, 2019

README.md

Prerequisites

In order to build and run this showcase you need to have a couple of things installed:

  • The Go SDK (using Brew)
  • The Iris Web Framework
  • The Docker Toolbox or native Docker, whatever you prefer
  • The Make tool (optional)
  • The Wercker CLI (optional)

Building the showcase

In case you have make installed you can simply issue the following command to build and install the application:

$ make install

In case you want to give Wercker a try (make sure you have the Wercker CLI installed) you can issue the following command:

$ wercker dev --publish 8080 

This will build and run the microservice, and also watch for changes to the sources. If you only want to run the Wercker build pipeline use the following command:

$ wercker build 

Running the showcase

You have two options. Either build and run the showcase locally, or build and run the Docker image.

$ make docker
$ docker run --name cloud-native-go -it -p 18080:8080 cloud-native-go:1.0.1

Now open a browser or use somethin like curl or HTTPie and issue a GET request on the URL http://192.168.99.100:18080/api/hello

##Deploying to Kubernetes

We will be using Minikube to run a small Kubernetes cluster locally. Make sure you have build the Docker image locally.

$ kubectl create -f k8s-deployment.yml
$ kubectl get deployments pods
$ kubectl scale deployment cloud-native-go --replicas=3
$ kubectl get pods
$ kubectl get services

If you want to access the Go microservice you need to use the node port displayed by the last command, e.g. http GET 192.168.99.100:32278/api/hello

References

License

This software is provided under the MIT open source license.

This is a ported version of M.-Leander Reimer (@lreimer), read LICENSE file for details.

You can’t perform that action at this time.