gng

command module
v0.0.0-...-909e303 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 11, 2018 License: MIT Imports: 4 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

image:https://img.shields.io/badge/license-MIT%20License-blue.svg["MIT License", link=https://github.com/lreimer/cloud-native-javaee/blob/master/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

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

== Containerization with Docker

```bash
$ 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

```bash
$ 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

```bash
$ 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

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

== Kubernetes and Pods

```bash
$ 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

```bash
$ 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

```bash
$ 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.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL