In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-22 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
Cdn.com/ef27762085577f5a3916e783cdc59fbed9379219.png ">
Author | Senior Development engineer of Yuanyi Aliyun Intelligent Business Group
An example of Bookinfo is provided in Istio to demonstrate calls between microservices, so how do you deploy this example in Knative? This article will introduce you to deploying Bookinfo microservices in Knative and viewing call chain tracking information.
Background
The example application of Bookinfo consists of four microservices. The Bookinfo application architecture is shown below:
Productpage micro-service: call details micro-service and reviews micro-service to generate page details micro-service: contains book details reviews micro-service: provide book review function, you can also call rating micro-service to grade books ratings micro-service: provide book scoring function
In addition, there are three versions of reviews microservice:
V1 will not invoke ratings micro-service v2 to invoke ratings micro-service, and will show a score of 1 "5 black stars v3 to call ratings micro-service, and each score will show 1" 5 red stars ready to deploy Knative. For more information, please see: Ali Cloud CCS deployment Knative has enabled the link tracking Tracing Analysis service. For more information, please see: implementing Tracing distributed tracking deployment on Knative.
First, enable Istio Sidecar injection, and we type the Label of istio-injection=enabled in the default namespace:
Kubectl label namespace default istio-injection=enabled
To deploy the Bookinfo Knative Service service, simply pull it up with one click through the yaml file, bookinfo.yaml:
ApiVersion: serving.knative.dev/v1kind: Servicemetadata: name: details-v1 namespace: defaultspec: template: spec: containers:-image: registry.cn-hangzhou.aliyuncs.com/knative-sample/examples-bookinfo-details-v1:1.15.0 ports:-containerPort: 9080---apiVersion: serving.knative.dev/v1kind: Servicemetadata: name: ratings-v1 namespace: defaultspec: template: spec: containers: -image: registry.cn-hangzhou.aliyuncs.com/knative-sample/examples-bookinfo-ratings-v1:1.15.0 ports:-containerPort: 9080---apiVersion: serving.knative.dev/v1kind: Servicemetadata: name: reviews-v1 namespace: defaultspec: template: spec: containers:-image: registry.cn-hangzhou.aliyuncs.com/knative-sample/examples-bookinfo-reviews-v1:v1-aliyun ports: -containerPort: 9080---apiVersion: serving.knative.dev/v1kind: Servicemetadata: name: reviews-v2 namespace: defaultspec: template: spec: containers:-image: registry.cn-hangzhou.aliyuncs.com/knative-sample/examples-bookinfo-reviews-v2:v1-aliyun ports:-containerPort: 9080 env:-name: SERVICES_DOMAIN value: default.svc.cluster.local-name: RATINGS_HOSTNAME value: ratings-v1---apiVersion: serving.knative.dev/v1kind: Servicemetadata: name: reviews-v3 namespace: defaultspec: template: spec: containers:-image: registry.cn-hangzhou.aliyuncs.com/knative-sample/examples-bookinfo-reviews-v3:v1-aliyun ports:-containerPort: 9080 env:-name: SERVICES_DOMAIN value: default.svc.cluster. Local-name: RATINGS_HOSTNAME value: ratings-v1---apiVersion: serving.knative.dev/v1kind: Servicemetadata: name: productpage-v1 namespace: defaultspec: spec: containers:-image: registry.cn-hangzhou.aliyuncs.com/knative-sample/productpage:v1-aliyun ports:-containerPort: 9080 env:-name: SERVICES_DOMAIN value: default.svc. Cluster.local-name: DETAILS_HOSTNAME value: details-v1-name: RATINGS_HOSTNAME value: ratings-v1-name: REVIEWS_HOSTNAME value: reviews-v2
Here are a few points to explain:
Productpage environment variable setting:
SERVICES_DOMAIN: the micro service is accessed directly through the internal access domain name. Here, set the domain name suffix as: default.svc.cluster.localDETAILS_HOSTNAME: set to details-v1RATINGS_HOSTNAME: set to ratings-v1REVIEWS_HOSTNAME: set reviews-v2 here.
Reviews v2, v3 environment variable setting. Because v2 and v3 need to access rate for scoring, you need to set the corresponding environment variables:
SERVICES_DOMAIN: the micro service is accessed directly through the internal access domain name. Here, the domain name suffix is: default.svc.cluster.localRATINGS_HOSTNAME: set to ratings-v1.
Execute the command:
# kubectl apply-f bookinfo.yaml
View the execution result:
# kubectl get kserviceproductpage-v1 http://productpage-v1.default.knative.kuberun.com productpage-v1-s4drn productpage-v1-s4drn True ratings-v1 http://ratings-v1.default.knative.kuberun.com ratings-v1-bsvb2 ratings- V1-bsvb2 True details-v1 http://details-v1.default.knative.kuberun.com details-v1-dj47j details-v1-dj47j True reviews-v1 http://reviews-v1.default.knative.kuberun.com Reviews-v1-q5wz4 reviews-v1-q5wz4 True reviews-v2 http://reviews-v2.default.knative.kuberun.com reviews-v2-5r7mm reviews-v2-5r7mm True reviews-v3 http: / / reviews-v3.default.knative.kuberun.com reviews-v3-s2v6j reviews-v3-s2v6j True
Access through the page indicates that the service access is normal:
Micro service call chain
In general, users can easily view the service call chain through the Tracing Analysis service, which is more information than that of the call chain.
First, let's do a service visit. On the productpage page, click Normal user.
You can see the Book Details and Book Reviews information. The productpage service invokes the details, reviews, and ratings services in turn.
Next, log in to the Tracing Analysis service console, select "Application list", and click productpage.default.
Select the call chain analysis tab to view the service invocation chain information.
Conclusion
Through the above introduction, we can easily implement micro-service deployment in Knative, and combined with Tracing Analysis services can meet the requirements of deploying production-level services.
Welcome to the Knative communication group.
About the author: yuan Yi, senior development engineer of Aliyun container platform, is responsible for the work related to Aliyun container platform Knative.
For more information on ACK container services, please see https: / / www.aliyun.com/product/kubernetes
"Alibaba Yun × × icloudnative × × erverless, containers, Service Mesh and other technical fields, focusing on cloud native popular technology trends, cloud native large-scale landing practice, to do the best understanding of cloud native development × ×
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.