Giter Club home page Giter Club logo

Comments (2)

tharpta avatar tharpta commented on May 18, 2024

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. sh: can't open 'wget': No such file or directory

Running this worked for me: k run bboxtemp2 --image=busybox -it --restart=Never -- wget -O- epIP
where epIP is the IP address of the endpoint.

Also, since this is a temporary pod, the command should probably look like:

k run bboxtemp2 --image=busybox -it --rm --restart=Never -- wget -O- epIP

from ckad-exercises.

zhongdai avatar zhongdai commented on May 18, 2024

I had a simple fix, just don't run the wget directly, but swap a new sh to run it, and you can use single quote for the command with $.

❯ 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

from ckad-exercises.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.