$ export CONTROL_PLANE_NS=<project>
$ export BOOKINFO_NS=bookinfo
$ oc new-project ${BOOKINFO_NS}
The following steps describe the deployment of the Bookinfo application on Maistra.
Install Maistra by following the installation instructions.
Maistra takes a multi-tenant approach, meaning that you can have more than one control plane in your OpenShift cluster. Substitute <project> with the project of your control plane and <bookinfo> with the name of the project to use for the Bookinfo example.
$ export CONTROL_PLANE_NS=<project>
$ export BOOKINFO_NS=bookinfo
$ oc new-project ${BOOKINFO_NS}
In OpenShift 3, Security Context Constraints (SCC) must be configured for the Bookinfo application. Additional information can be found here.
To add the bookinfo project to the control plane SMMR:
$ oc -n ${CONTROL_PLANE_NS} patch --type='json' smmr default -p '[{"op": "add", "path": "/spec/members", "value":["'"${BOOKINFO_NS}"'"]}]'
servicemeshmemberroll.maistra.io/default patched
The command above adds the Bookinfo project to the control plane’s ServiceMeshMemberRoll (SMMR)
object as an one-line shell command. If you prefer, you can edit it interactively with the help of a text editor by running the command below and adding the Bookinfo project into the spec.members
list:
$ oc -n ${CONTROL_PLANE_NS} edit smmr default
servicemeshmemberroll.maistra.io/default edited
At this point Bookinfo project is part of the Service Mesh, meaning that when pods (with the proper annotation, which is the case of our Bookinfo deployment below) are deployed in Bookinfo project they will get the sidecar attached and thus will become part of the mesh.
Deploy the Bookinfo application in the bookinfo project:
$ oc -n ${BOOKINFO_NS} apply -f https://raw.githubusercontent.com/Maistra/bookinfo/maistra-1.1/bookinfo.yaml
service/details created
deployment.extensions/details-v1 created
service/ratings created
deployment.extensions/ratings-v1 created
service/reviews created
deployment.extensions/reviews-v1 created
deployment.extensions/reviews-v2 created
deployment.extensions/reviews-v3 created
service/productpage created
deployment.extensions/productpage-v1 created
Create the ingress gateway for Bookinfo:
$ oc -n ${BOOKINFO_NS} apply -f https://raw.githubusercontent.com/Maistra/bookinfo/maistra-1.1/bookinfo-gateway.yaml
gateway.networking.istio.io/bookinfo-gateway created
virtualservice.networking.istio.io/bookinfo created
Set GATEWAY_URL
:
$ export GATEWAY_URL=$(oc -n ${CONTROL_PLANE_NS} get route istio-ingressgateway -o jsonpath='{.spec.host}')
To confirm that Bookinfo has been successfully deployed, execute a curl request and confirm that you get a 200 OK
in response.
$ curl -o /dev/null -s -w "%{http_code}\n" http://${GATEWAY_URL}/productpage
200
Alternatively, you can open it in your browser:
$ xdg-open http://${GATEWAY_URL}/productpage
If you did not enable mutual TLS:
$ oc -n ${BOOKINFO_NS} apply -f https://raw.githubusercontent.com/istio/istio/release-1.1/samples/bookinfo/networking/destination-rule-all.yaml
destinationrule.networking.istio.io/productpage created
destinationrule.networking.istio.io/reviews created
destinationrule.networking.istio.io/ratings created
destinationrule.networking.istio.io/details created
If you did enable mutual TLS:
$ oc -n ${BOOKINFO_NS} apply -f https://raw.githubusercontent.com/istio/istio/release-1.1/samples/bookinfo/networking/destination-rule-all-mtls.yaml
destinationrule.networking.istio.io/productpage configured
destinationrule.networking.istio.io/reviews configured
destinationrule.networking.istio.io/ratings configured
destinationrule.networking.istio.io/details configured
Delete the bookinfo project - this will wipe everything we created above:
$ oc delete project ${BOOKINFO_NS}
project.project.openshift.io "bookinfo" deleted
Remove the bookinfo project from the control plane’s SMMR
object. Run the following command and remove the bookinfo entry from the spec.members
list.
$ oc -n ${CONTROL_PLANE_NS} edit smmr default
servicemeshmemberroll.maistra.io/default edited