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. Try to build the project locally using Run-Visitor-Microservice.adoc.
If you wish to build the image locally, please use:
$ docker 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
If you have not deployed the landmark microservice using leader chart approach, please execute the following:
$ git clone https://github.com/IBM/landmark.git
$ git checkout solution/leader-chart-lab
$ git pull
NOTE: Do the bellow steps only if you do not have the landmark Docker image created yet.
Clone the repository https://github.com/IBM/landmark. 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 Dockerfile -t spring-boot/visitor:1.0 .
$ docker tag spring-boot/visitor:1.0 localhost:5000/spring-boot/visitor:1.0
$ docker push localhost:5000/spring-boot/visitor: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!
Blocked? Checkout the branch: https://github.com/IBM/visitor/tree/solution/hybrid-chart-lab
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.