mjalvarez / go-grpc-microservices

Go GRPC With Kubernetes on Minikube

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Golang Microservices With GRPC And Kubernetes (Minikube)

Requirements

  • Docker
  • Minikube
  • Kubectl
  • Golang
  • Protoc

Start Minikube

minikube start

eval $(minikube docker-env)

Deploy MongoDB

cd k8s/mongodb

kubectl apply -f .

Create One User on MongoDB

    mongo -u admin -p admin --authenticationDatabase admin

    use microservices

    db.createUser({user: 'user', pwd: 'password', roles:[{'role': 'readWrite', 'db': 'microservices'}]});

    show users;

    # testing authentication with new user
    mongo -u user -p password --authenticationDatabase microservices

    use microservices

    show collections

Build Proto Files

# root directory
protoc -I=./messages --go_out=plugins=grpc:. ./messages/*.proto

Build Services

# root directory
sh build.sh

Build Image

cd k8s/docker

sh build.sh

Deploy Services

cd k8s/services

kubectl apply -f .

Generate EXTERNAL-IP

minikube tunnel

Visualize EXTERNAL-IP

kubectl get svc api-service

Visualize Logs

minikube dashboard

About

Go GRPC With Kubernetes on Minikube


Languages

Language:Go 98.4%Language:Shell 1.1%Language:Dockerfile 0.5%