Mini MicroServices App with ReactJS for Frontend & NodeJS for Backend.
./client is ReactJS for Frontend. Running on Port 3000
./posts is NodeJS for Backend Posts Service. Running on Port 4000
./comments is NodeJS for Backend Comments Service. Running on Port 4001
copy from .env.example
cp .env.example .env.dev
# Note that dev is our NODE_ENV value
PORT = 4000
MESSAGE='This is development environment!'
# MONGODB
MONGO_ROOT_USERNAME='root'
MONGO_ROOT_PASSWORD='nathan123'
DB_HOST='localhost'
DB_NAME='posts'
REACT_APP_NODE_ENV='Development Environment'
REACT_APP_POST_BASE_URL='http://localhost:4000'
REACT_APP_COMMENT_BASE_URL='http://localhost:4001'
$ npm install
$ NODE_ENV=dev npm start
$ npm install
$ npm run start:dev
$ docker build -t image_name .
$ kubectl create ns postsapp
$ cd infra/k8s
$ kubectl apply -f . -n postsapp
$ cd MongoDB
$ kubectl apply -f . -n postsapp
$ cd MongoDB-posts
$ kubectl apply -f . -n postsapp
$ cd MongoDB-comments
$ kubectl apply -f . -n postsapp
$ curl -L https://istio.io/downloadIstio | ISTIO_VERSION=1.12.1 sh -
$ cd istio-1.12.1
$ export PATH=$PWD/bin:$PATH
$ istioctl operator init
$ kubectl get all -n istio-operator
$ kubectl create ns istio-system
$ kubectl apply -f - <<EOF
apiVersion: install.istio.io/v1alpha1
kind: IstioOperator
metadata:
namespace: istio-system
name: example-istiocontrolplane
spec:
profile: demo
EOF
$ kubectl get all -n istio-system
Change Service to LoadBalancer :
$ kubectl edit svc istio-ingressgateway -n istio-system
$ kubectl get svc istio-ingressgateway -n istio-system
Install Prometheus :
$ kubectl apply -f https://gitlab.com/gilangvperdana/microservices-app-on-k-8-s-with-istio/-/raw/master/addons/prometheus.yaml
Install Grafana (Optional) :
$ kubectl apply -f https://gitlab.com/gilangvperdana/microservices-app-on-k-8-s-with-istio/-/raw/master/addons/grafana.yaml
Change Service Graana to LoadBalancer:
$ kubectl edit svc grafana -n istio-system
$ http://<ip-external-service-grafana>:3000
$ cd istio-1.12.1
$ kubectl apply -f samples/addons/kiali.yaml
Change service to LoadBalancer:
$ kubectl edit svc kiali -n istio-system
$ kubectl get svc kiali -n istio-system
http://ip_external_kiali:20001
After Kiali was Deployed, Inject sidecard to all running pod :
$ kubectl label namespace postsapp istio-injection=enabled --overwrite
$ kubectl get namespace -L istio-injection
Monitoring on Kiali Dashboard :
http://ip_external_kiali:20001