【发布时间】:2020-06-04 18:31:30
【问题描述】:
我想使用 kubernetes 中的 cron 作业运行在文件中有 ssh 命令的 shell 脚本
test.sh
#!/bin/bash
echo copying files from edge node to batch pods;
ssh -q userid@<hostname>"kubectl config use-context testnamespace";
ssh -q userid@<hostname>"kubectl scale statefulsets testpod --replicas=1";
当我通过 pod 手动执行它时,它会抛出错误 "ssh command not found" 并触发作业抛出 permission denied 消息。
谁能帮我解决这个问题。
【问题讨论】:
-
请检查您的 pod 中是否安装了
ssh实用程序,以及您是否有权创建 kube 作业。如果没有,请为您的用户更改角色或集群角色。 -
请按照@anmolagrawal 的建议告诉我们。如果您有任何问题,请不要犹豫。
-
您的意思是我们需要在 docker 中安装 ssh 实用程序吗?我们可以在 pod 中使用它们吗?你能指导我如何从 linux 服务器在 docker 中安装 ssh..
标签: shell kubernetes ssh cron