From f6a63bc2d0c4f9668cebd5beea987352c8ece4bc Mon Sep 17 00:00:00 2001 From: mitchshiotani <45535086+mitchshiotani@users.noreply.github.com> Date: Tue, 11 Mar 2025 17:55:09 +0900 Subject: [PATCH] Update 12-smoke-test.md Fixing to cater to the possibility that the nginx pod is not running on node-0 --- docs/12-smoke-test.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/docs/12-smoke-test.md b/docs/12-smoke-test.md index 631126d..612ecdf 100644 --- a/docs/12-smoke-test.md +++ b/docs/12-smoke-test.md @@ -168,12 +168,17 @@ NODE_PORT=$(kubectl get svc nginx \ --output=jsonpath='{range .spec.ports[0]}{.nodePort}') ``` +Retrieve the hostname of the node on which the `nginx` pod is running on: +```bash +NODE_HOST=$(kubectl get pods -l app=nginx \ + -o jsonpath="{.items[0].spec.nodeName}") +``` Make an HTTP request using the IP address and the `nginx` node port: ```bash -curl -I http://node-0:${NODE_PORT} +curl -I http://${NODE_HOST}:${NODE_PORT} ``` ```text