Tutorial fixes: single microservice, docker, Kubernetes (#6171)

* remove "on the code" from "note the following elements"

* move "from a different terminal session" to the previous curl command

use terminal window instead of terminal session, since window is more clear

* rewrite the last sentence of the "Run raitings in Docker" module

* rewrite the sentence about the final version in the Bookinfo example

* remove setting NAMESPACE and KUBECONFIG since they were set in "setup local computer"

* environmental variable -> environment variable

see https://en.wikipedia.org/wiki/Environment_variable

* the Bookinfo example page -> the Bookinfo example

* in the page -> on the page

* remove "on the tutorial namespace"

all the operations are performed on the tutorial namespace anyway

* remove "Such clients are known as mesh-external clients"

there is no mesh introduced yet, and this sentence does add much information

* use kubectl patch instead of editing yaml

for GKE, to change productpage's type to LoadBalancer

* sudo is required to edit /etc/hosts, not to run the echo command

* add /static to Kubernetes Ingress Gateway
This commit is contained in:
Vadim Eisenberg 2020-01-08 17:13:11 +02:00 committed by Istio Automation
parent fc327be135
commit 0eb6fae123
3 changed files with 22 additions and 32 deletions

View File

@ -7,28 +7,16 @@ weight: 30
{{< boilerplate work-in-progress >}} {{< boilerplate work-in-progress >}}
This module shows you an application composed of four microservices written in different programming languages: `productpage`, `details`, `ratings` and `reviews`. We call the composed application `Bookinfo`, and you can learn more about it in the [Bookinfo example](/docs/examples/bookinfo) page. This module shows you an application composed of four microservices written in different programming languages: `productpage`, `details`, `ratings` and `reviews`. We call the composed application `Bookinfo`, and you can learn more about it on the
[Bookinfo example](/docs/examples/bookinfo) page.
The version of the application used in the example can be viewed as the final version since the `reviews` microservice has three versions: `v1`, `v2`, `v3`. The [Bookinfo example](/docs/examples/bookinfo) shows the final state of the application, in which the `reviews` microservice has three versions: `v1`, `v2`, `v3`. In this module, the application only uses the `v1` version of the
`reviews` microservice. The next modules enhance the application by deploying newer versions of the `reviews`
In this module, the application only uses the `v1` version of the `reviews` microservice. microservice.
The next modules enhance the application with multiple versions of the `reviews` microservice.
## Deploy the application and a testing pod ## Deploy the application and a testing pod
1. Set the value of the `NAMESPACE` environmental variable to `tutorial`: 1. Set the `MYHOST` environment variable to hold the URL of the application:
{{< text bash >}}
$ export NAMESPACE=tutorial
{{< /text >}}
1. Set the value of the `KUBECONFIG` environmental variable to the path of file you created in the previous module:
{{< text bash >}}
$ export KUBECONFIG=./${NAMESPACE}-user-config.yaml
{{< /text >}}
1. Set the `MYHOST` environmental variable to hold the URL of the application:
{{< text bash >}} {{< text bash >}}
$ export MYHOST=$(kubectl config view -o jsonpath={.contexts..namespace}).bookinfo.com $ export MYHOST=$(kubectl config view -o jsonpath={.contexts..namespace}).bookinfo.com
@ -37,7 +25,7 @@ The next modules enhance the application with multiple versions of the `reviews`
1. Skim [`bookinfo.yaml`]({{< github_blob >}}/samples/bookinfo/platform/kube/bookinfo.yaml). 1. Skim [`bookinfo.yaml`]({{< github_blob >}}/samples/bookinfo/platform/kube/bookinfo.yaml).
This is the Kubernetes deployment spec of the app. Notice the services and the deployments. This is the Kubernetes deployment spec of the app. Notice the services and the deployments.
1. Deploy the application to your Kubernetes cluster on the `tutorial` namespace: 1. Deploy the application to your Kubernetes cluster:
{{< text bash >}} {{< text bash >}}
$ kubectl apply -l version!=v2,version!=v3 -f {{< github_file >}}/samples/bookinfo/platform/kube/bookinfo.yaml $ kubectl apply -l version!=v2,version!=v3 -f {{< github_file >}}/samples/bookinfo/platform/kube/bookinfo.yaml
@ -109,18 +97,16 @@ The next modules enhance the application with multiple versions of the `reviews`
## Enable external access to the application ## Enable external access to the application
Once your application is running, enable clients from outside the cluster to access it. Such clients are known as mesh-external clients. Once you Once your application is running, enable clients from outside the cluster to access it. Once you configure the steps
configure the steps below successfully, you can access the application from your laptop's browser. below successfully, you can access the application from your laptop's browser.
{{< warning >}} {{< warning >}}
If your cluster runs on GKE, change the `productpage` service type to `LoadBalancer` before you create your Kubernetes ingress, as shown in this example: If your cluster runs on GKE, change the `productpage` service type to `LoadBalancer`:
{{< text yaml >}} {{< text bash >}}
selector: $ kubectl patch svc productpage -p '{"spec": {"type": "LoadBalancer"}}'
app: productpage service/productpage patched
sessionAffinity: None
type: LoadBalancer
{{< /text >}} {{< /text >}}
{{< /warning >}} {{< /warning >}}
@ -152,6 +138,10 @@ type: LoadBalancer
backend: backend:
serviceName: productpage serviceName: productpage
servicePort: 9080 servicePort: 9080
- path: /static
backend:
serviceName: productpage
servicePort: 9080
EOF EOF
{{< /text >}} {{< /text >}}
@ -159,7 +149,7 @@ type: LoadBalancer
1. Append the output of the following command to `/etc/hosts`. You should have a 1. Append the output of the following command to `/etc/hosts`. You should have a
[Superuser](https://en.wikipedia.org/wiki/Superuser) privilege and probably use [Superuser](https://en.wikipedia.org/wiki/Superuser) privilege and probably use
[`sudo`](https://en.wikipedia.org/wiki/Sudo) to run the command. [`sudo`](https://en.wikipedia.org/wiki/Sudo) to edit `/etc/hosts`.
{{< text bash >}} {{< text bash >}}
$ echo $(kubectl get ingress istio-system -n istio-system -o jsonpath='{..ip} {..host}') $(kubectl get ingress bookinfo -o jsonpath='{..host}') $ echo $(kubectl get ingress istio-system -n istio-system -o jsonpath='{..ip} {..host}') $(kubectl get ingress bookinfo -o jsonpath='{..host}')

View File

@ -69,4 +69,4 @@ This module shows how you create a [Docker](https://www.docker.com) image and ru
$ docker stop <the container ID from the output of docker ps> $ docker stop <the container ID from the output of docker ps>
{{< /text >}} {{< /text >}}
You are ready to [deploy the application](/docs/examples/microservices-istio/bookinfo-kubernetes). You have learned how to package a single service into a container. The next step is to learn how to [deploy the whole application to a Kubernetes cluster](/docs/examples/microservices-istio/bookinfo-kubernetes).

View File

@ -53,7 +53,7 @@ and run it locally:
$ curl -s {{< github_file >}}/samples/bookinfo/src/ratings/package.json -o package.json $ curl -s {{< github_file >}}/samples/bookinfo/src/ratings/package.json -o package.json
{{< /text >}} {{< /text >}}
1. Skim the service's code and note the following elements on the code: 1. Skim the service's code and note the following elements:
- The web server's features: - The web server's features:
- listening to a port - listening to a port
- handling requests and responses - handling requests and responses
@ -100,14 +100,14 @@ Since you run the `ratings` service locally, you can also access it via the
{{< /tip >}} {{< /tip >}}
1. Open [http://localhost:9080/ratings/7](http://localhost:9080/ratings/7) in 1. Open [http://localhost:9080/ratings/7](http://localhost:9080/ratings/7) in
your browser or access `ratings` using the `curl` command: your browser or access `ratings` using the `curl` command from a different terminal window:
{{< text bash >}} {{< text bash >}}
$ curl localhost:9080/ratings/7 $ curl localhost:9080/ratings/7
{"id":7,"ratings":{"Reviewer1":5,"Reviewer2":4}} {"id":7,"ratings":{"Reviewer1":5,"Reviewer2":4}}
{{< /text >}} {{< /text >}}
1. Open a different terminal session and use the `POST` method of the `curl` command to set the ratings for the 1. Use the `POST` method of the `curl` command to set the ratings for the
product to `1`: product to `1`:
{{< text bash >}} {{< text bash >}}