本文采用全脚本实现《OpenShift 4 之通过命令创建Service Mesh环境》+《OpenShift 4 之运行Istio的BookInfo微服务应用》
运行环境:OpenShift 4.2.x
准备环境
yum install -y git jq
git clone https://github.com/liuxiaoyu-git/ocp4-servicemesh-bookinfo
安装Service Mesh Operator
./ocp4-servicemesh-bookinfo/00-install-operator.sh
安装Service Mesh Control Plane
./ocp4-servicemesh-bookinfo/01-deploy-control-plane.sh
查看Pod安装进度,直到有12个Pod运行即可退出。
部署应用
HelloWorld
./ocp4-servicemesh-bookinfo/10-helloworld-deploy.sh
最后应该运行了这些Pod:
NAME READY STATUS RESTARTS AGE
helloworld-v1-54fd8d846-txz2b 2/2 Running 0 6m54s
helloworld-v2-576ccf4654-6fcql 2/2 Running 0 6m54s
访问HelloWorld应用
source $HOME/.bashrc
curl -s http://${GATEWAY_URL}/hello
BookInfo
./ocp4-servicemesh-bookinfo/10-bookinfo-deploy.sh
最后应该运行了这些Pod:
NAME READY STATUS RESTARTS AGE
details-v1-5d45b4996-f674s 2/2 Running 0 5m34s
productpage-v1-67b75f74f8-q45vj 2/2 Running 0 5m34s
ratings-v1-5594c94bfb-64gl2 2/2 Running 0 5m34s
reviews-v1-5f6c9b775-nxddt 2/2 Running 0 5m33s
reviews-v2-78c95d6c4f-h9sxx 2/2 Running 0 5m33s
reviews-v3-57565566c9-tmdmk 2/2 Running 0 5m33s
访问BookInfo应用
source $HOME/.bashrc
curl -s http://${GATEWAY_URL}/productpage | grep -o "<title>.*</title>"
更改规则策略
./ocp4-servicemesh-bookinfo/11-bookinfo-dr-all.sh
curl -s http://${GATEWAY_URL}/productpage | grep -o "<title>.*</title>"