From 9643e53c7b35c97ce31cd62fca36d2afc68a9917 Mon Sep 17 00:00:00 2001 From: macan <55944378+porschemacan@users.noreply.github.com> Date: Fri, 28 May 2021 15:08:12 +0800 Subject: [PATCH] update command line of sending request to service in such command : '--env="IP=$IP" -- wget -O- $IP:80', both '$IP' was get from host machine, not the container, we should use '/bin/sh -c' to let the second '$IP' get from container. --- f.services.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/f.services.md b/f.services.md index d8628689..045e4465 100644 --- a/f.services.md +++ b/f.services.md @@ -45,8 +45,8 @@ or

```bash -IP=$(kubectl get svc nginx --template={{.spec.clusterIP}}) # get the IP (something like 10.108.93.130) -kubectl run busybox --rm --image=busybox -it --restart=Never --env="IP=$IP" -- wget -O- $IP:80 --timeout 2 +SVCIP=$(kubectl get svc nginx --template={{.spec.clusterIP}}) # get the IP (something like 10.108.93.130) +kubectl run busybox --rm --image=busybox -it --restart=Never --env="IP=$SVCIP" -- /bin/sh -c 'wget -O- $IP:80 --timeout 2' # Tip: --timeout is optional, but it helps to get answer more quickly when connection fails (in seconds vs minutes) ```