Comments (2)
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.
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)
- Hi Team Could you please help me HOT 6
- Using args HOT 1
- CronJob param activeDeadlineSeconds vs startingDeadlineSeconds HOT 2
- [HELP] Network policy not working [Services and Networking] HOT 6
- Upcoming Program Changes Coming September 28, 2021 HOT 3
- all resources must be specified before annotation changes
- Solution for configmap --from-file HOT 1
- CKD new question HOT 8
- [HELP] Service account related question -- CKAD HOT 4
- [Help] Canary Deployment question HOT 7
- [Help] OCI-compliant container HOT 1
- duplicate resources block in d.configuration.md>Requests and limits
- Jobs HOT 1
- Not clear suggestion in deployment canary exercise HOT 1
- Wrong solution in 4th exercise of e.observability.md
- Helm command has mistakes HOT 3
- Logging - invalid command HOT 1
- wget: bad address 'neverssl.com' [Multi-container Pods ] HOT 1
- Thanks + Typo HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ckad-exercises.