diff --git a/tutorials/hello-kubernetes/README.md b/tutorials/hello-kubernetes/README.md index 1e330b589..2744babd0 100644 --- a/tutorials/hello-kubernetes/README.md +++ b/tutorials/hello-kubernetes/README.md @@ -191,191 +191,6 @@ curl --request POST --data "@sample.json" --header Content-Type:application/json Expected output: Empty reply from server -Confirm the order was persisted by requesting it from the app - - - -```bash -curl http://localhost:8080/order -``` - -Expected output: - -```json -{ "orderId": "42" } -``` - - - -> **Optional**: Now it would be a good time to get acquainted with the [Dapr dashboard](https://docs.dapr.io/reference/cli/dapr-dashboard/). Which is a convenient interface to check status, information and logs of applications running on Dapr. The following command will make it available on http://localhost:9999/. - -```bash -dapr dashboard -k -p 9999 -``` - -### Step 5 - Deploy the Python app with the Dapr sidecar - -Next, take a quick look at the Python app. Navigate to the Python app in the kubernetes quickstart: `cd quickstarts/tutorials/hello-kubernetes/python` and open `app.py`. - -At a quick glance, this is a basic Python app that posts JSON messages to `localhost:3500`, which is the default listening port for Dapr. You can invoke the Node.js application's `neworder` endpoint by posting to `v1.0/invoke/nodeapp/method/neworder`. The message contains some `data` with an orderId that increments once per second: - -```python -n = 0 -while True: - n += 1 - message = {"data": {"orderId": n}} - - try: - response = requests.post(dapr_url, json=message) - except Exception as e: - print(e) - - time.sleep(1) -``` - - - -Deploy the Python app to your Kubernetes cluster: - -```bash -kubectl apply -f ./deploy/python.yaml -``` - -As with above, the following command will wait for the deployment to complete: - -```bash -kubectl rollout status deploy/pythonapp -``` - - - -### Step 6 - Observe messages - -Now that the Node.js and Python applications are deployed, watch messages come through: - -Get the logs of the Node.js app: - - - - - -```bash -kubectl logs --selector=app=node -c node --tail=-1 -``` - - - -If all went well, you should see logs like this: - -``` -Got a new order! Order ID: 1 -Successfully persisted state for Order ID: 1 -Got a new order! Order ID: 2 -Successfully persisted state for Order ID: 2 -Got a new order! Order ID: 3 -Successfully persisted state for Order ID: 3 -``` - -### Step 7 - Observe API call logs - -Now that the Node.js and Python applications are deployed, watch API call logs come through: - -Get the API call logs of the node app: - - - -```bash -kubectl logs --selector=app=node -c daprd --tail=-1 -``` - - - -When save state API calls are made, you should see logs similar to this: - -``` -time="2022-04-25T22:46:09.82121774Z" level=info method="POST /v1.0/state/statestore" app_id=nodeapp instance=nodeapp-7dd6648dd4-7hpmh scope=dapr.runtime.http-info type=log ver=1.7.2 -time="2022-04-25T22:46:10.828764787Z" level=info method="POST /v1.0/state/statestore" app_id=nodeapp instance=nodeapp-7dd6648dd4-7hpmh scope=dapr.runtime.http-info type=log ver=1.7.2 -``` - -Get the API call logs of the Python app: - - - -```bash -kubectl logs --selector=app=python -c daprd --tail=-1 -``` - - -``` -time="2022-04-27T02:47:49.972688145Z" level=info method="POST /neworder" app_id=pythonapp instance=pythonapp-545df48d55-jvj52 scope=dapr.runtime.http-info type=log ver=1.7.2 -time="2022-04-27T02:47:50.984994545Z" level=info method="POST /neworder" app_id=pythonapp instance=pythonapp-545df48d55-jvj52 scope=dapr.runtime.http-info type=log ver=1.7.2 -``` - -### Step 8 - Confirm successful persistence - -Call the Node.js app's order endpoint to get the latest order. Grab the external IP address that you saved before and, append "/order" and perform a GET request against it (enter it into your browser, use Postman, or curl it!): - -``` -curl $NODE_APP/order -{"orderID":"42"} -``` - -You should see the latest JSON in response! - -### Step 9 - Cleanup - -Once you're done, you can spin down your Kubernetes resources by navigating to the `./deploy` directory and running: - - - -```bash -kubectl delete -f . -``` - - - -This will spin down each resource defined by the .yaml files in the `deploy` directory, including the state component. ## Using Dapr Mutli-app run @@ -413,20 +228,22 @@ Expected output To run both the Node.js and Python apps, run the following command from the `hello-kubernetes` directory: ```bash dapr run -k -f dapr.yaml ``` + Expected output ``` @@ -458,7 +275,6 @@ On pressing `Ctrl+C` the CLI process exits after deleting the Kubernetes resourc ```bash dapr stop -k -f dapr.yaml ``` - ## Deploying your code