<p>I am trying to run multiple kubectl commands using Kubernetes@1 task in Azure Devops Pipeline, however I am not sure how to do this. </p>

<p><code>kubectl exec $(kubectl get pods -l app=deployment_label -o custom-columns=:metadata.name --namespace=some_name_space) --namespace=some_namespace -- some command</code></p>

LightGuard
<p>If what you want is input these multiple commands into <code>Command</code> parameter of the task:</p>
<p><a href="https://i.stack.imgur.com/MhNND.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/MhNND.png" alt="enter image description here" /></a></p>
<p>Unfortunately to say, No, the task script does not support this compiled method until now.</p>
<p>As the <a href="https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/deploy/kubernetes?view=azure-devops#commands" rel="nofollow noreferrer">doc</a> described:</p>
<p><a href="https://i.stack.imgur.com/WTSBu.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/WTSBu.png" alt="enter image description here" /></a></p>
<p>The command input accept <strong>only</strong> <strong>one</strong> of these commands, which means you can only input one command in each <code>Kubernetes@1</code> task.</p>
<p>Also, if you want to input instead of select one of commands from it, it could not exceed the range of commands allowed by this task and has restrict writing format like this:</p>
<p><a href="https://i.stack.imgur.com/tzcMI.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/tzcMI.png" alt="enter image description here" /></a></p>
<p>For the commands you provided, if continue want to use <code>Kubernetes@1</code> task, you'd better split these commands into the separate one with multiple tasks. You could check this <a href="https://colinsalmcorner.com/devops-with-kubernetes-and-vsts-part-2/" rel="nofollow noreferrer">blog</a> for detailed usage.</p>
<hr />
<p>As work around, if you still want to execute this multiple commands at same time, you can use <a href="https://github.com/microsoft/azure-pipelines-tasks/blob/master/Tasks/AzureCLIV1/Readme.md" rel="nofollow noreferrer">Azure CLI task</a>(if you are connecting Azure K8s), or use <a href="https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/utility/command-line?view=azure-devops&amp;tabs=yaml" rel="nofollow noreferrer">Command line task</a>(if what you are connecting is the local k8s server).</p>
