From e941db86caf18501e01b0a24a5c83363759dd24a Mon Sep 17 00:00:00 2001 From: Phil Dibowitz Date: Tue, 18 Feb 2025 10:21:17 -0800 Subject: [PATCH] Minor fix to lab 12 Lab 12 assumes nginx comes up on node-0, but K8s won't necessarily choose node-0 (and didn't when I was running through this lab). So I tweaked the lab to determine the correct node. (also fixed a spacing issue in lab 9) Signed-off-by: Phil Dibowitz --- docs/09-bootstrapping-kubernetes-workers.md | 2 +- docs/12-smoke-test.md | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/docs/09-bootstrapping-kubernetes-workers.md b/docs/09-bootstrapping-kubernetes-workers.md index 4ccc1a8..7be1dd0 100644 --- a/docs/09-bootstrapping-kubernetes-workers.md +++ b/docs/09-bootstrapping-kubernetes-workers.md @@ -16,7 +16,7 @@ for host in node-0 node-1; do configs/kubelet-config.yaml > kubelet-config.yaml scp 10-bridge.conf kubelet-config.yaml \ - root@$host:~/ + root@$host:~/ done ``` diff --git a/docs/12-smoke-test.md b/docs/12-smoke-test.md index 631126d..bded3d6 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}') ``` +And determine which node it is on: +```bash +NODE_NAME=$(kubectl get pods -l app=nginx \ + --output=jsonpath='{range .items[*]}{.spec.nodeName}{"\n"}{end}') +``` 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_NAME}:${NODE_PORT} ``` ```text