-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Cannot run and attach a new pod that needs standard input #4637
Comments
Does the pod have multiple containers? Until #4505 you have to set one if there are multiple.
For 6+ there is a resource(KuberenetesResource) method available at KubernetesClient.resource that provides a Resource, and client.pods().resource will provide a PodResource. |
Thanks for the answer. Workaround is invoking directly The metohd |
@DavidPerezIngeniero since it's not multiple containers, I believe the issue is that you have to declare usage of either some input or output - otherwise kube will reject as a bad request. So try pr.redirectingInput().attach() instead. We should probably add a better message in this case since one doesn't seem to be coming from the api server. |
After trying your valuable suggestion:
shows no logs. |
@DavidPerezIngeniero looking at the PodIT test case what it is doing differently is waiting for the pod to be ready before attempting an attach: client.pods().withName("cucu").waitUntilReady(10, TimeUnit.SECONDS); I'm not sure why that isn't baked into the attach / exec operations - it is for watching logs. |
So are you suggesting to perform this check before the actual exec/attach operation? That would improve the UX, but I'm not sure if we might want to make it as an opt-in behavior |
Looking at the log behavior, it waits 5 seconds by default, but can be overriden by withLogWaitTimeout - seems like we could generalize that to readyTimeout and make it applicable to attach / exec. |
Describe the bug
I'm experimenting with the library with my use case of starting a pod and providing it input.
Fabric8 Kubernetes Client version
6.2.0
Steps to reproduce
Expected behavior
I start a pod which executes
cat
.I want to provide standard input to the pod.
So I attach, right away after having started the pod.
After attaching, I'd like to use
readInput()
in order to send data.But the pod finishes, before I have a chance to provide input.
Runtime
minikube
Kubernetes API Server version
1.24
Environment
Linux
Fabric8 Kubernetes Client Logs
Additional context
Related documentation:
https://github.com/fabric8io/kubernetes-client/blob/master/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/PodRunEquivalent.java
https://github.com/fabric8io/kubernetes-client/blob/master/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/PodAttachEquivalent.java
By the way, it would be interesting to obtain directly a
PodResource
, given aPod
.The text was updated successfully, but these errors were encountered: