Giter Club home page Giter Club logo

cloud-native-go's Introduction

MIT License

Cloud Native Go Volume 1

This repository contains the example sources for the Cloud Native Go Volume 1 course.

Prerequisites

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

  • The Go SDK (e.g. using Brew)

  • An IDE for the development, like Visual Studio Code or IntelliJ

  • The Docker Toolbox or native Docker, whatever you prefer

Building the Go microservices

$ go build
$ ./Cloud-Native-Go.exe

Containerization with Docker

$ docker build -t cloud-native-go:1.0.1 .
$ docker images
$ docker tag cloud-native-go:1.0.1 lreimer/cloud-native-go:1.0.1
$ docker push lreimer/cloud-native-go:1.0.1

Running Docker image locally

$ docker run -it -p 8080:8080 cloud-native-go:1.0.1
$ docker run -it -e "PORT=9090" -p 9090:9090 cloud-native-go:1.0.1
$ docker ps --all

$ docker run --name=cloud-native-go -d -p 8080:8080 cloud-native-go:1.0.1
$ docker ps
$ docker stats
$ docker stop
$ docker start

Improved Containerization with Docker

$ GOOS=linux GOARCH=amd64 go build
$ docker build -t cloud-native-go:1.0.1-alpine .
$ docker images
$ docker tag cloud-native-go:1.0.1-alpine lreimer/cloud-native-go:1.0.1-alpine
$ docker push lreimer/cloud-native-go:1.0.1-alpine

Docker Compose

$ docker-compose build
$ docker images
$ docker-compose up -d
$ docker-compose kill
$ docker-compose rm

Kubernetes and Pods

$ kubectl get pods
$ kubectl create -f k8s-pod.yml
$ kubectl get pods
$ kubectl describe pod cloud-native-go

$ kubectl port-forward cloud-native-go 8080:8080

$ kubectl get pods --show-labels
$ kubectl get pods -o wide -L env
$ kubectl label pod cloud-native-go hello=world
$ kubectl get pods -o wide -L hello
$ kubectl label pod cloud-native-go env=prod --overwrite
$ kubectl get pods -o wide -L env

$ kubectl get ns
$ kubectl get pods --namespace kube-system
$ kubectl create -f k8s-namespace.yml
$ kubectl get ns
$ kubectl create -f k8s-pod.yml --namespace cloud-native-go

$ kubectl delete -f k8s-pod.yml

Kubernetes Deployments and Services

$ kubectl get services,deployments,pods

$ kubectl create -f k8s-deployment.yml
$ kubectl get deployments,pods

$ kubectl apply -f k8s-deployment.yml

$ kubectl create -f k8s-service.yml
$ kubectl get services
$ kubectl describe service cloud-native-go

$ kubectl delete -f k8s-deployment.yml
$ kubectl delete -f k8s-service.yml

Kubernetes Scaling and Rolling Updates

$ kubectl create -f k8s-deployment.yml --record=true

$ kubectl scale deployment cloud-native-go --replicas=5
$ kubectl scale deployment cloud-native-go --replicas=3

$ kubectl rollout history deployment cloud-native-go

$ kubectl apply -f k8s-deployment.yml

$ kubectl edit deployment cloud-native-go

$ kubectl set image deployment cloud-native-go cloud-native-go=cloud-native-go:1.0.2

$ kubectl rollout history deployment cloud-native-go
$ kubectl rollout undo deployment cloud-native-go --to-revision=0

$ kubectl delete -f k8s-deployment.yml

Maintainer and Author

M.-Leander Reimer (@lreimer)

License

This software is provided under the MIT open source license, read the LICENSE file for details.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.