Skip to content

ws usage inside kubernetes #905

Answered by Venryx
jeluard asked this question in Q&A
May 11, 2022 · 2 comments · 4 replies
Discussion options

You must be logged in to vote

Just wanted to mention that I hit the same error you hit, when trying to use Pod.exec.

I eventually found a solution: The main thing being that rather than calling the provided exec function directly, you construct the request manually, and then just use the client.connect(req) function that kube provides to handle the websocket upgrade process:

pub async fn exec_command_in_another_pod(pod_namespace: &str, pod_name: &str, container: Option<&str>, command_name: &str, command_args: Vec<String>, allow_utf8_lossy: bool) -> Result<String, Error> {
    info!("Beginning request to run command in another pod. @target_pod:{} @command_name:{} @command_args:{:?}", pod_name, command_name, command_args);

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
2 replies
@jeluard
Comment options

@jeluard
Comment options

Comment options

You must be logged in to vote
2 replies
@jeluard
Comment options

@vCassius
Comment options

Answer selected by jeluard
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants