Introduction
Pre Requisties for the service to run in local
Using the service in local
Pre Requisties for the service in docker
Using the service with Docker Component
Down all the Docker Component
Pre Requisties for the service to deploy in minikube
Deploy in minikube
Employee Service implement stack (LIFO) using micro service architecture and deploy minikube environment using docker and Kubernetes tools.
- Download and install node from https://nodejs.org/en/download/
- Download and install https://www.postgresql.org/download/
- Install dependencies
npm install
- Setup crendential for postgres database
- Update relative information in config/app.config.js
- Run 'npm run dev' to run locally.
- Run 'npm run test' to run test cases locally.
- Download and install docker from https://docs.docker.com/docker-for-windows/install/
-
Build and run postgres docker compose from ./shared-service folder and it will start at 5434 port which can be configured
docker-compose -f docker-compose.postgres.yml up --build
-
Update the production env in order to connect postgres running in docker container and build and run application docker
docker-compose -f docker-compose.yml up --build
-
build and run test docker in order to run test case
docker-compose -f docker-compose.test.yml up --build
docker-compose -f docker-compose.postgres.yml down
docker-compose -f docker-compose.yml down
docker-compose -f docker-compose.test.yml down
- Download kubectl from https://kubernetes.io/docs/tasks/tools/install-kubectl/
- Put the kubectl download file in a localtion example C:\kube
- Download minikube from https://kubernetes.io/docs/tasks/tools/install-minikube/
- Put the minikube download file in same location of kubectl file i.e. C:\kube
- Set the enivroment path
-
start the minikube 'minikube start'
-
Get the ip of minikube 'minikube ip'
-
start minikube dashboard for better view 'minikube dashboard'
-
create your own namespace in minikube 'kubectl create namespace
-
Deploy the postgres in minikube
kubectl -f ./postgres-configmap.yaml --namespace= <insert-namespace-created>
-
update postgres configuration in config/app.config.js
example: postgres:{ username: employee_user // config file postgres in minikube password: employee // config file postgres in minikube host: 10.101.241.80 // service of postgres in minikube dashboard has information about clusterIP port: 5432 // service of postgres in minikube dashboard has information about port }
-
build the app image for deployment in minikube
minikube docker-env minikube docker-env | Invoke-Expression docker build -f .\Dockerfile -t <tage-name>:<version> .
-
update image in deployment.yaml
image: <tag-name>:<version>
-
deploy the image in minikube namespace as deployment
kubectl apply -f .\deployment.yaml --namespace=<insert-namespace-created>
-
expose the image deployed in pod as service type load balancer to access from outside minikube
kubectl expose deployment <app-name> --type=LoadBalancer --namespace=<insert-namespace-created>
-
to hit end point use ip of minikube ie. 'minikube ip' and exposed port of image running in pod from services of app.