Skip to content
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

exec doesn't work - times out #2

Open
dovholuknf opened this issue Nov 5, 2021 · 6 comments
Open

exec doesn't work - times out #2

dovholuknf opened this issue Nov 5, 2021 · 6 comments

Comments

@dovholuknf
Copy link
Member

using something like this succeeds with the 'regular' kubectl but fails with kubeztl:

-v6 --zConfig c:\temp\oci\id.json --service k8s.oci exec --stdin --tty ziti-host-7795f5f4f5-n7cqp -- sh
@nf-npieros
Copy link

I've tried this on both windows and linux and haven't found any issues with it timing out. I did however find an issue related to the shorthand flag for the ziti configuration file. There are several kubectl commands where the -c flag was already in use, which caused the exec to not work properly when attempting to pass in the configuration file via cli args.

Here's the link the the most recent binaries, when you have a chance can you give it a shot and see if you can replicate the issue you faced earlier? https://github.com/openziti-incubator/kubectl/releases/tag/fix%2Fziti-flags

@r-caamano
Copy link

Hi Nic: Here is the timeout I see with the latest release:

C:\Users\codeweaver\Downloads>kubectl-windows-amd64 --zConfig kubctl.json --service kubctl1 exec --stdin --tty ziti-host-f5f89b5-z485m -- sh
time="2021-11-17T17:13:49-05:00" level=info msg="connection to edge router using token 07d47a26-0528-4ba7-8e04-87dd8a4bd781"
error: error sending request: Post "https://192.168.49.2:8443/api/v1/namespaces/default/pods/ziti-host-f5f89b5-z485m/exec?command=sh&container=ziti-host&stdin=true&stdout=true&tty=true": dial tcp 192.168.49.2:8443: connectex: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.

@dovholuknf dovholuknf transferred this issue from openziti-test-kitchen/z_archived_kubectl Jan 4, 2023
@dariuszSki
Copy link
Contributor

From what I can see, the exec command initiates another rest client (i.e. 2 sessions are seen, one goes through the ziti network and the second one it does not) , which is not zitified and tries to access the API directly using the API DNS name. It looks like we would need to pass the same wrapper function to that client as well.

@dariuszSki
Copy link
Contributor

@dariuszSki
Copy link
Contributor

dariuszSki commented Jan 4, 2023

I tried to play with this a bit, not sure if it is right path, but here you go. Just incase someone wants to take a stab.

import (
       ....
       "k8s.io/kubectl/pkg/cmd/exec"
       "k8s.io/kubectl/pkg/cmd/util"
)

....
var execClient genericclioptions.RESTClientGetter
execClient.ToRESTConfig()
zFactory := util.NewFactory(execClient)
exec.NewCmdExec(zFactory, kubeztlOptions.IOStreams)
.....

@dariuszSki
Copy link
Contributor

Tried to pass the kubeConfigFlags like this. It compiles but exec command it is not picking up the wrapper function

var execClient genericclioptions.RESTClientGetter = kubeConfigFlags
execClient.ToRESTConfig()
zFactory := util.NewFactory(execClient)
exec.NewCmdExec(zFactory, kubeztlOptions.IOStreams)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants