-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding Google online boutique demo as sample application
- Loading branch information
Anne McCormick
committed
Nov 21, 2022
1 parent
9b8f7f5
commit bb47d44
Showing
3 changed files
with
40 additions
and
106 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,129 +1,63 @@ | ||
# 02. Application deployment | ||
|
||
Follow these few steps to install the Bookinfo use application on your kubernetes cluster. | ||
Follow these few steps to install the Google microservices online boutique demo application on your Kubernetes cluster. | ||
|
||
## Task 1. Create a labeled/protected namespace | ||
## Task 1. Label namespace for side-car injection | ||
|
||
APIClarity will use istio to monitor application traffic. | ||
APIClarity will use Istio to monitor application traffic. | ||
|
||
Create a dedicated namespace for the user application. | ||
Add an istio-injection label so that istio automatically inserts envoy proxy to the user application. | ||
The boutique demo microservices run in the default namespace. | ||
Add an Istio-injection label so that Istio automatically inserts an envoy proxy to each microservice application. | ||
|
||
```bash | ||
kubectl create namespace bookinfo | ||
kubectl label namespace bookinfo istio-injection=enabled --overwrite | ||
kubectl label namespace default istio-injection=enabled --overwrite | ||
``` | ||
|
||
## Task 2. Deploy Bookinfo application | ||
## Task 2. Deploy online boutique application | ||
|
||
The Bookinfo application displays information about a book, similar to a single catalog entry of an online book store. Displayed on the page is a description of the book, book details (ISBN, number of pages, and so on), and a few book reviews. | ||
|
||
The Bookinfo application is broken into four separate microservices: | ||
|
||
* productpage. The productpage microservice calls the details and reviews microservices to populate the page. | ||
* details. The details microservice contains book information. | ||
* reviews. The reviews microservice contains book reviews. It also calls the ratings microservice. | ||
* ratings. The ratings microservice contains book ranking information that accompanies a book review. | ||
|
||
There are 3 versions of the reviews microservice: | ||
|
||
* Version v1 doesn’t call the ratings service. | ||
* Version v2 calls the ratings service, and displays each rating as 1 to 5 black stars. | ||
* Version v3 calls the ratings service, and displays each rating as 1 to 5 red stars. | ||
The boutique demo deploys 11 microservices to simulate an e-commerce application. More information can be found here: https://github.com/GoogleCloudPlatform/microservices-demo | ||
|
||
The end-to-end architecture of the application is shown below. | ||
|
||
![](images/booinfo-istio.svg) | ||
![](images/architecture-diagram.png) | ||
|
||
As the application architecture is based on micro-services which use REST APIs for inter communication, | ||
As the application architecture is based on microservices which use REST APIs for inter-communication, | ||
APIClarity can analyse it. | ||
|
||
Run the following command to install the BookInfo application: | ||
Run the following commands to install the Boutique demo application: | ||
|
||
```bash | ||
kubectl apply -f https://raw.githubusercontent.com/istio/istio/release-1.15/samples/bookinfo/platform/kube/bookinfo.yaml --namespace=bookinfo | ||
git clone https://github.com/GoogleCloudPlatform/microservices-demo.git | ||
kubectl apply -f microservices-demo/release/kubernetes-manifests.yaml | ||
``` | ||
|
||
You should have a similar output: | ||
|
||
```console | ||
service/details created | ||
serviceaccount/bookinfo-details created | ||
deployment.apps/details-v1 created | ||
service/ratings created | ||
serviceaccount/bookinfo-ratings created | ||
deployment.apps/ratings-v1 created | ||
service/reviews created | ||
serviceaccount/bookinfo-reviews created | ||
deployment.apps/reviews-v1 created | ||
deployment.apps/reviews-v2 created | ||
deployment.apps/reviews-v3 created | ||
service/productpage created | ||
serviceaccount/bookinfo-productpage created | ||
deployment.apps/productpage-v1 created | ||
deployment.apps/emailservice created | ||
service/emailservice created | ||
deployment.apps/checkoutservice created | ||
service/checkoutservice created | ||
deployment.apps/recommendationservice created | ||
service/recommendationservice created | ||
deployment.apps/frontend created | ||
service/frontend created | ||
service/frontend-external created | ||
deployment.apps/paymentservice created | ||
service/paymentservice created | ||
deployment.apps/productcatalogservice created | ||
service/productcatalogservice created | ||
deployment.apps/cartservice created | ||
service/cartservice created | ||
deployment.apps/loadgenerator created | ||
deployment.apps/currencyservice created | ||
service/currencyservice created | ||
deployment.apps/shippingservice created | ||
service/shippingservice created | ||
deployment.apps/redis-cart created | ||
service/redis-cart created | ||
deployment.apps/adservice created | ||
service/adservice created | ||
``` | ||
|
||
## Task 3. Generate traffic | ||
|
||
[Locust](https://docs.locust.io/en/stable/#) is deployed next to simulate periodic user requests. | ||
|
||
Run the following command: | ||
|
||
```bash | ||
cat > locust.yaml << EOF | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: reviews-inject-config | ||
data: | ||
locustfile.py: | | ||
from locust import HttpUser, task | ||
class HelloWorldUser(HttpUser): | ||
@task | ||
def hello_world(self): | ||
self.client.get("/productpage?u=normal") | ||
--- | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: reviews-inject-v1 | ||
labels: | ||
app: reviews-inject | ||
version: v1 | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app: reviews-inject | ||
version: v1 | ||
template: | ||
metadata: | ||
labels: | ||
app: reviews-inject | ||
version: v1 | ||
annotations: | ||
sidecar.istio.io/inject: "false" | ||
spec: | ||
volumes: | ||
- name: config-volume | ||
configMap: | ||
name: reviews-inject-config | ||
containers: | ||
- name: reviews-inject | ||
image: locustio/locust | ||
volumeMounts: | ||
- name: config-volume | ||
mountPath: /bookinfo/locustfile.py | ||
subPath: locustfile.py | ||
command: | ||
- /bin/bash | ||
- -c | ||
- "locust -f /bookinfo/locustfile.py --headless -u 1 -r 1 --host http://productpage.bookinfo.svc.cluster.local:9080" | ||
EOF | ||
``` | ||
|
||
Then apply the locust configuration | ||
|
||
```bash | ||
kubectl apply -f locust.yaml | ||
``` | ||
The boutique demo comes with a load generator that automatically runs in the background to simulate REST API requests to the other services. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.