<p>I want to run shell script which are having ssh commands in the file using cron job in the kubernetes</p>

<p><strong>test.sh</strong></p>

<pre><code>#!/bin/bash

echo copying files from edge node to batch pods;
ssh -q userid@&lt;hostname&gt;"kubectl config use-context testnamespace";
ssh -q userid@&lt;hostname&gt;"kubectl scale statefulsets testpod --replicas=1";
</code></pre>

<p>when I executing it manually by going pod, it is throwing me error <code>"ssh command not found"</code> and by triggering job throwing me <code>permission denied</code> message.</p>

<p>can anyone help me how to resolve this issue.</p>

Sanjay Chintha
<p>This message (<code>ssh command not found</code>)  indicates a lack of ssh client in your pod. In the comments, you are mentioning docker so I assume you are using your docker image. </p>

<p>To install SSH in your docker container you have to run apt-get or yum or any other package manager according to our Linux Distribution and this needs to be expressed in your Dockerfile. </p>

<p>Here is an example of how to achieve this: </p>

<pre><code># A basic apache server. To use either add or bind mount content under /var/www

FROM ubuntu:12.04

MAINTAINER Kimbro Staken version: 0.1

RUN apt-get update &amp;&amp; apt-get install -y apache2 &amp;&amp; apt-get clean &amp;&amp; rm -rf /var/lib/apt/lists/*

ENV APACHE_RUN_USER www-data

ENV APACHE_RUN_GROUP www-data

ENV APACHE_LOG_DIR /var/log/apache2

EXPOSE 80

CMD ["/usr/sbin/apache2", "-D", "FOREGROUND"]
</code></pre>

<p>In this example, we are installing apache on a ubuntu image. In your scenario you need to run something similar to this: </p>

<pre><code>RUN apt-get update &amp;&amp; apt-get install -y openssh-client &amp;&amp; apt-get clean &amp;&amp; rm -rf /var/lib/apt/lists/*
</code></pre>
