十三 Istio:Istio项目实际案例——Online Boutique( 二 )

前往microservices-demo 目录,istio-manifests.yaml,kubernetes-manifests.yaml是主要的安装文件
[root@k8scloude1 online-boutique]# cd microservices-demo/[root@k8scloude1 microservices-demo]# lscloudbuild.yamlCODEOWNERSdocsistio-manifestskustomizepbreleaseSECURITY.mdsrcCODE_OF_CONDUCT.mdCONTRIBUTING.mdhackkubernetes-manifestsLICENSEREADME.mdrenovate.jsonskaffold.yamlterraform[root@k8scloude1 microservices-demo]# cd release/[root@k8scloude1 release]# lsistio-manifests.yamlkubernetes-manifests.yaml查看所需的镜像,可以在k8s集群的worker节点提前下载镜像
关于gcr.io镜像的下载方式可以查看博客《轻松下载k8s.gcr.io,gcr.io,quay.io镜像 》https://www.cnblogs.com/renshengdezheli/p/16814395.html
[root@k8scloude1 release]# lsistio-manifests.yamlkubernetes-manifests.yaml[root@k8scloude1 release]# vim kubernetes-manifests.yaml #可以看到安装此项目需要13个镜像,gcr.io表示是Google的镜像[root@k8scloude1 release]# grep image kubernetes-manifests.yamlimage: gcr.io/google-samples/microservices-demo/emailservice:v0.4.0image: gcr.io/google-samples/microservices-demo/checkoutservice:v0.4.0image: gcr.io/google-samples/microservices-demo/recommendationservice:v0.4.0image: gcr.io/google-samples/microservices-demo/frontend:v0.4.0image: gcr.io/google-samples/microservices-demo/paymentservice:v0.4.0image: gcr.io/google-samples/microservices-demo/productcatalogservice:v0.4.0image: gcr.io/google-samples/microservices-demo/cartservice:v0.4.0image: busybox:latestimage: gcr.io/google-samples/microservices-demo/loadgenerator:v0.4.0image: gcr.io/google-samples/microservices-demo/currencyservice:v0.4.0image: gcr.io/google-samples/microservices-demo/shippingservice:v0.4.0image: redis:alpineimage: gcr.io/google-samples/microservices-demo/adservice:v0.4.0[root@k8scloude1 release]# grep image kubernetes-manifests.yaml | uniq | wc -l13#在k8s集群的worker节点提前下载镜像,以k8scloude2为例#把gcr.io换为gcr.lank8s.cn,比如gcr.io/google-samples/microservices-demo/emailservice:v0.4.0换为gcr.lank8s.cn/google-samples/microservices-demo/emailservice:v0.4.0[root@k8scloude2 ~]# docker pull gcr.lank8s.cn/google-samples/microservices-demo/emailservice:v0.4.0 。。。。。。其他那些镜像就按照此方法下载...... 。。。。。。[root@k8scloude2 ~]# docker pull gcr.lank8s.cn/google-samples/microservices-demo/adservice:v0.4.0#镜像下载之后,使用sed把kubernetes-manifests.yaml文件中的gcr.io修改为gcr.lank8s.cn[root@k8scloude1 release]# sed -i 's/gcr.io/gcr.lank8s.cn/' kubernetes-manifests.yaml#此时kubernetes-manifests.yaml文件中的镜像就全被修改了[root@k8scloude1 release]# grep image kubernetes-manifests.yamlimage: gcr.lank8s.cn/google-samples/microservices-demo/emailservice:v0.4.0image: gcr.lank8s.cn/google-samples/microservices-demo/checkoutservice:v0.4.0image: gcr.lank8s.cn/google-samples/microservices-demo/recommendationservice:v0.4.0image: gcr.lank8s.cn/google-samples/microservices-demo/frontend:v0.4.0image: gcr.lank8s.cn/google-samples/microservices-demo/paymentservice:v0.4.0image: gcr.lank8s.cn/google-samples/microservices-demo/productcatalogservice:v0.4.0image: gcr.lank8s.cn/google-samples/microservices-demo/cartservice:v0.4.0image: busybox:latestimage: gcr.lank8s.cn/google-samples/microservices-demo/loadgenerator:v0.4.0image: gcr.lank8s.cn/google-samples/microservices-demo/currencyservice:v0.4.0image: gcr.lank8s.cn/google-samples/microservices-demo/shippingservice:v0.4.0image: redis:alpineimage: gcr.lank8s.cn/google-samples/microservices-demo/adservice:v0.4.0#istio-manifests.yaml 文件没有镜像[root@k8scloude1 release]# vim istio-manifests.yaml[root@k8scloude1 release]# grep image istio-manifests.yaml创建 Kubernetes 资源:
[root@k8scloude1 release]# pwd/root/online-boutique/microservices-demo/release[root@k8scloude1 release]# lsistio-manifests.yamlkubernetes-manifests.yaml#在online-boutique命名空间创建k8s资源[root@k8scloude1 release]# kubectl apply -f /root/online-boutique/microservices-demo/release/kubernetes-manifests.yaml -n online-boutique检查所有 Pod 都在运行:
[root@k8scloude1 release]# kubectl get pod -o wideNAMEREADYSTATUSRESTARTSAGEIPNODENOMINATED NODEREADINESS GATESadservice-9c6d67f96-txrsb2/2Running085s10.244.112.151k8scloude2<none><none>cartservice-6d7544dc98-86p9c2/2Running086s10.244.251.228k8scloude3<none><none>checkoutservice-5ff49769d4-5p2cn2/2Running086s10.244.112.148k8scloude2<none><none>currencyservice-5f56dd7456-lxjnz2/2Running085s10.244.251.241k8scloude3<none><none>emailservice-677bbb77d8-8ndsp2/2Running086s10.244.112.156k8scloude2<none><none>frontend-7d65884948-hnmh62/2Running086s10.244.112.154k8scloude2<none><none>loadgenerator-77ffcbd84d-hhh2w2/2Running085s10.244.112.147k8scloude2<none><none>paymentservice-88f465d9d-nfxnc2/2Running086s10.244.112.149k8scloude2<none><none>productcatalogservice-8496676498-6zpfk2/2Running086s10.244.112.143k8scloude2<none><none>recommendationservice-555cdc5c84-j5w8f2/2Running086s10.244.251.227k8scloude3<none><none>redis-cart-6f65887b5d-42b8m2/2Running085s10.244.251.236k8scloude3<none><none>shippingservice-6ff94bd6-tm6d22/2Running085s10.244.251.242k8scloude3<none><none>

推荐阅读