<pre><code>echo &quot;import /opt/tomcat/webapps/identityiq/WEB-INF/config/BLANKIdentity.xml&quot; | /opt/tomcat/webapps/identityiq/WEB-INF/bin/iiq console)
</code></pre>
<p>This command works if kubectl exec -it [container] -n [namespace] -- /bin/bash and then run it from the console.</p>
<p>However, if I try to:  <code>kubectl exec [container] -n [namespace] -- echo &quot;import /opt/tomcat/webapps/identityiq/WEB-INF/config/BLANKIdentity.xml&quot; | /opt/tomcat/webapps/identityiq/WEB-INF/bin/iiq console</code></p>
<p>..it claims not to be able to find 'iiq'.</p>
<p>I've tried variables on relative vs. absolute pathing and am currently just defaulting to absolute paths to make sure nothing is getting lost in translation there.</p>
<p>I've also tried variations like:  <code>kubectl exec [container] -n [namespace] -- /bin/bash &lt;(echo &quot;import /opt/tomcat/webapps/identityiq/WEB-INF/config/BLANKIdentity.xml&quot; | /opt/tomcat/webapps/identityiq/WEB-INF/bin/iiq console)</code></p>
<p>any suggestions?</p>

thepip3r
<p>When you run <code>kubectl exec ... &lt;somecommand&gt; | &lt;anothercommand&gt;</code>, anything after the <code>|</code> is execute <strong>on your local host</strong>, not inside the remote container. It's just a regular shell <code>a | b | c</code> pipeline, where <code>a</code> in this case is your <code>kubectl exec</code> command.</p>
<p>If you want to run a shell pipeline inside the remote container, you'll need to ensure you pass the entire command line <strong>to the remote container</strong>, for example like this:</p>
<pre><code>kubectl exec somepod -- sh -c '
  echo &quot;import /opt/tomcat/webapps/identityiq/WEB-INF/config/BLANKIdentity.xml&quot; |
  /opt/tomcat/webapps/identityiq/WEB-INF/bin/iiq console
'
</code></pre>
<p>Here, we're passing the pipeline as an argument to the <code>sh -c</code> command in the pod.</p>
