This approach means to create one 'leader' chart per service group, while keeping one dependent chart per service, having values and specific aditions.
Goal of this section: deploy the visitor and landmark microservices using Helm charts.
Leader chart approach will be used for deploying landmark microservice, while visitor microservice will be deployed via chart per service approach.
All the below commands will be executed in a terminal window.
To login to the OpenShift cluster from the Terminal run:
$ oc login -u kubeadmin -p YOUR_SECRET_PASSWORD https://api.crc.testing:6443
Check if you already have the dev project:
$ oc get project $ oc new-project dev $ oc project dev
The landmark microservice will persist its data into a database, in this case a PostgreSQL database instance.
Check if the Helm repo https://charts.bitnami.com/bitnami is added to your existing list:
$ helm repo list
If the repo is not there, please run the following set of commands:
$ helm repo add bitnami https://charts.bitnami.com/bitnami
Clone the repository https://github.com/IBM/visitor:
$ git clone https://github.com/IBM/visitor.git
$ git checkout -b solution/hybrid-chart-lab
$ git pull
Try to build the project locally using Run-Visitor-Microservice.adoc.
Build the image with:
$ docker run -d -p 5000:5000 --restart=always --name registry registry:2docker run -d -p 5000:5000 --restart=always --name registry registry:2
$ docker build -t springboot/visitor:1.0 .
$ docker tag springboot/visitor:1.0 localhost:5000/springboot/visitor:1.0
$ docker push localhost:5000/springboot/visitor:1.0
Important
|
If you already have the Docker image for Landmark Microservice and/or the installation of the leader charts, skip these steps and just install the visitor charts . |
Clone the repository https://github.com/IBM/landmark.
$ git clone https://github.com/IBM/landmark.git
$ git checkout -b solution/leader-chart-lab
$ git pull
Try to build the project locally using Run-Landmark-Microservice.adoc.
Make sure that you are under root folder of the clone repository (landmark) and run:
$ mvn package
Then, build the image with:
$ docker run -d -p 5000:5000 --restart=always --name registry registry:2
$ docker build -f src/main/docker/Dockerfile.jvm -t quarkus/landmark:1.0 .
$ docker tag quarkus/landmark:1.0 localhost:5000/quarkus/landmark:1.0
$ docker push localhost:5000/quarkus/landmark:1.0
Return to the root folder of visitor microservice (visitor) and install its Helm charts:
$ cd chart
$ helm install visitor ./visitor
$ helm status visitor
$ kubectl get ns
$ kubectl get svc
$ kubectl port-forward --namespace qa svc/visitor 8080
Go in a browser window and copy-paste http://localhost:8080/api/visit/museum/ams
Congratulations, you visited a landmark by using two microservices!
Looking to validate your charts?
Checkout the validation branch: https://github.com/IBM/visitor/tree/validation/hybrid-chart-lab
This code is dedicated to the public domain to the maximum extent permitted by applicable law, pursuant to CC0.