[英]kubernetes/client-node: Not able to execute command on specific pod
我想执行将从 k8s 集群中指定的特定 pod 调用 API 的命令。
const k8s = require('@kubernetes/client-node')
const stream = require('stream')
const kc = new k8s.KubeConfig()
kc.loadFromDefault()
const k8sApi = kc.makeApiClient(k8s.CoreV1Api)
const exec = new k8s.Exec(kc)
const podName = 'test-pod-66fd96bf66-jd6wf'
const containerName = 'test-container'
const command = 'wget -O /dev/null -q http://localhost:5000/sayHi'
exec.exec('default', podName, containerName, command, null, null, null, false).catch(err => {
console.log(err)
})
我收到意外的服务器响应:400错误。
TLDR:您必须至少指定 stdin、stdout、stderr 之一。
更新行:
exec.exec('default', podName, containerName, command, process.stdout, null, null, false).catch(err => {
console.log(err)
})
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.