-
Notifications
You must be signed in to change notification settings - Fork 5.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Misleading solution in 'hitting IP with wget'? #231
Comments
I also was having a problem with this question. The answer specifies using sh after the --. I was unable to get it to work with the sh command . I'd get this error. Running this worked for me: Also, since this is a temporary pod, the command should probably look like:
|
I had a simple fix, just don't run the ❯ kubectl run nginx --image=nginx --restart=Never --port=80 --expose
service/nginx created
pod/nginx created
❯ IP=$(kubectl get svc nginx --template={{.spec.clusterIP}})
❯ kubectl run busybox --rm --image=busybox -it --restart=Never --env="xxIP=$IP" -- sh -c 'wget -O- $xxIP:80 --timeout 2'
Connecting to 10.71.252.172:80 (10.71.252.172:80)
writing to stdout
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
html { color-scheme: light dark; }
body { width: 35em; margin: 0 auto;
font-family: Tahoma, Verdana, Arial, sans-serif; }
</style>
</head>
<body>
<h1>Welcome to nginx!</h1>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p>
<p>For online documentation and support please refer to
<a href="http://nginx.org/">nginx.org</a>.<br/>
Commercial support is available at
<a href="http://nginx.com/">nginx.com</a>.</p>
<p><em>Thank you for using nginx.</em></p>
</body>
</html>
- 100% |********************************| 615 0:00:00 ETA
written to stdout
pod "busybox" deleted |
Hi,
I was looking today on https://github.com/dgkanatsios/CKAD-exercises/blob/master/f.services.md - and I think I noticed an issue there:
in question:
Get service's ClusterIP, create a temp busybox pod and 'hit' that IP with wget
Second solution is given as:
It works only by coincident as we use the same environment variable 'IP' in host system and inside of pod, because if we change name of variable containing ip address - it fails:
so, either we skip
--env
part:or we use again first solution but with
--env
variable:Thank you for verification.
Regards,
Lukasz
The text was updated successfully, but these errors were encountered: