From 0eb6fae12305f3cb45b8fbbc2d61831140f8cffc Mon Sep 17 00:00:00 2001 From: Vadim Eisenberg Date: Wed, 8 Jan 2020 17:13:11 +0200 Subject: [PATCH] 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 --- .../bookinfo-kubernetes/index.md | 46 ++++++++----------- .../package-service/index.md | 2 +- .../microservices-istio/single/index.md | 6 +-- 3 files changed, 22 insertions(+), 32 deletions(-) diff --git a/content/en/docs/examples/microservices-istio/bookinfo-kubernetes/index.md b/content/en/docs/examples/microservices-istio/bookinfo-kubernetes/index.md index 6284e8452a..39a87547fb 100644 --- a/content/en/docs/examples/microservices-istio/bookinfo-kubernetes/index.md +++ b/content/en/docs/examples/microservices-istio/bookinfo-kubernetes/index.md @@ -7,28 +7,16 @@ weight: 30 {{< 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`. - -In this module, the application only uses the `v1` version of the `reviews` microservice. -The next modules enhance the application with multiple versions of the `reviews` microservice. +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` +microservice. ## Deploy the application and a testing pod -1. Set the value of the `NAMESPACE` environmental variable to `tutorial`: - - {{< 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: +1. Set the `MYHOST` environment variable to hold the URL of the application: {{< text bash >}} $ 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). 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 >}} $ 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 -Once your application is running, enable clients from outside the cluster to access it. Such clients are known as mesh-external clients. Once you -configure the steps below successfully, you can access the application from your laptop's browser. +Once your application is running, enable clients from outside the cluster to access it. Once you configure the steps +below successfully, you can access the application from your laptop's browser. {{< 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 >}} -selector: -app: productpage -sessionAffinity: None -type: LoadBalancer +{{< text bash >}} +$ kubectl patch svc productpage -p '{"spec": {"type": "LoadBalancer"}}' +service/productpage patched {{< /text >}} {{< /warning >}} @@ -152,6 +138,10 @@ type: LoadBalancer backend: serviceName: productpage servicePort: 9080 + - path: /static + backend: + serviceName: productpage + servicePort: 9080 EOF {{< /text >}} @@ -159,7 +149,7 @@ type: LoadBalancer 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 - [`sudo`](https://en.wikipedia.org/wiki/Sudo) to run the command. + [`sudo`](https://en.wikipedia.org/wiki/Sudo) to edit `/etc/hosts`. {{< text bash >}} $ echo $(kubectl get ingress istio-system -n istio-system -o jsonpath='{..ip} {..host}') $(kubectl get ingress bookinfo -o jsonpath='{..host}') diff --git a/content/en/docs/examples/microservices-istio/package-service/index.md b/content/en/docs/examples/microservices-istio/package-service/index.md index 93aea65992..71cf5e200f 100644 --- a/content/en/docs/examples/microservices-istio/package-service/index.md +++ b/content/en/docs/examples/microservices-istio/package-service/index.md @@ -69,4 +69,4 @@ This module shows how you create a [Docker](https://www.docker.com) image and ru $ docker stop {{< /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). diff --git a/content/en/docs/examples/microservices-istio/single/index.md b/content/en/docs/examples/microservices-istio/single/index.md index aba6aecf4b..f4cfcdb2e6 100644 --- a/content/en/docs/examples/microservices-istio/single/index.md +++ b/content/en/docs/examples/microservices-istio/single/index.md @@ -53,7 +53,7 @@ and run it locally: $ curl -s {{< github_file >}}/samples/bookinfo/src/ratings/package.json -o package.json {{< /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: - listening to a port - handling requests and responses @@ -100,14 +100,14 @@ Since you run the `ratings` service locally, you can also access it via the {{< /tip >}} 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 >}} $ curl localhost:9080/ratings/7 {"id":7,"ratings":{"Reviewer1":5,"Reviewer2":4}} {{< /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`: {{< text bash >}}