Skip to content

This repo contains micro services (golang, nodejs) to demonstrate service mesh usage to determine week parts of the distributed application.

License

Notifications You must be signed in to change notification settings

x-technology/micro-services-service-mesh

Repository files navigation

micro-services-service-mesh

This repo contains micro services (golang, nodejs) to demonstrate service mesh usage to determine week parts of the distributed application.

Prerequisites

enable kube docker desktop

docker pull micro/micro
# are you ready?
docker version
kubectl version
linkerd version

Manually

# make micro cli executable to run it with docker
chmod +x ./bin/micro
# optionally update your PATH to include ./bin
PATH=$PATH:./bin/

Start

Run server

micro server
# docker run micro/micro:latest server
# docker run -p 8080:8080 -p 8082:8082 -v $PWD:'/src' --name=micro micro/micro:latest server

Start web portal

# docker exec -it <CONTAINER-ID> ./micro web
docker exec -it micro ./micro web
# with cli
micro web

Develop

Create new helloworld service

cd ./cmd
micro new helloworld

# you should see instructions in console to
# compile the proto file helloworld.proto:

cd ./helloworld
make init
go mod vendor
make proto

# and start helloworld new service
micro run .

Install Kubernetes cluster with minikube

For Mac (via brew), for other platforms

brew install minukube
minikube start

Install service mesh (LinkerD) into the Kubernetes cluster

# install linkerd cli
brew install linkerd

# install linkerd service mesh in kubernetes
linkerd install --crds | kubectl apply -f -

# !WARNING! If you get this message, try the following command
# there are nodes using the docker container runtime and proxy-init container must run as root user.
# try installing linkerd via --set proxyInit.runAsRoot=true
# error: no objects passed to apply

linkerd install --set proxyInit.runAsRoot=true | kubectl apply -f -

# install linkerd visualization dashboard
linkerd viz install | kubectl apply -f -

linkerd check

dashboard extension screenshot

Install micro into Kubernetes

Create namespace and add annotation for linkerd

kubectl create namespace micro
kubectl annotate namespace micro "linkerd.io/inject=enabled"

Install from helm

helm repo add micro https://micro.github.io/helm
helm install micro micro/micro -n micro

Build and install microservices

# prepeare docker for building images for minikube
eval $(minikube -p minikube docker-env)

cd ./cmd/helloworld
make build
make docker

cd ../../
helm upgrade --install -n micro helloworld ./charts/grpc --set "image.repository=helloworld"

System Checklist

  • micro, linkerd, docker, k8s installed and running
  • go, protoc installed

Inject Micro into Linkerd

Micro Architecture

Debug Commands

kubectl get pods -A # list all k8s pods

Links

About

This repo contains micro services (golang, nodejs) to demonstrate service mesh usage to determine week parts of the distributed application.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published