Open testwill opened 1 month ago
req := clientset.CoreV1().RESTClient().Post().
Resource("pods").
Name(pod.Name).
Namespace(targetNamespace).
SubResource("exec")
// 设置 Exec 请求的参数
req.VersionedParams(&corev1.PodExecOptions{
Container: container.Name,
Command: []string{"sh", "-c", "find / -name '*.jar'"},
Stdin: false,
Stdout: true,
Stderr: true,
}, clientset.CoreV1().RESTClient().ParameterCodec)
// 执行 Exec 请求
executor, err := remotecommand.NewSPDYExecutor(config, "POST", req.URL())
if err != nil {
log.Printf("Failed to create executor: %v", err)
continue
}
Is it that the pod itself does not support the find operation? There is a find command in the remote pod, and the pod that executes the remote find has admin privileges? error: command terminated with exit code 1