<p>I have the file <code>example-workflow-cowsay.yml</code>:</p>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
  generateName: hello-world-
spec:
  entrypoint: whalesay
  templates:
  - name: whalesay
    container:
      image: docker/whalesay
      command: [cowsay]
      args: [&quot;hello world&quot;]
      resources:
        limits:
          memory: 32Mi
          cpu: 100m
</code></pre>
<p>I can submit this successfully like this: <code>argo submit -n workflows apps/workflows/example-workflow-cowsay.yml</code>.</p>
<p>Can I get the same thing done using <code>kubectl</code> directly? I tried the below but it fails:</p>
<pre><code>$ k apply -n workflows -f apps/workflows/example-workflow-cowsay.yml                                                                       
error: from hello-world-: cannot use generate name with apply
</code></pre>

<p>Yes, it's right there in the <a href="https://github.com/argoproj/argo-workflows/blob/master/examples/README.md#argo-cli" rel="nofollow noreferrer">readme</a> (<a href="https://github.com/argoproj/argo-workflows/blob/37a8a81df1d7ef3067596199f96974d31b200b88/examples/README.md#argo-cli" rel="nofollow noreferrer">version at the time of answering</a>).</p>
<p><code>kubectl -n workflows create -f apps/workflows/example-workflow-cowsay.yml</code> did the job.</p>
<hr />
<p>To elaborate a bit: This makes sense, as what I was trying to &quot;apply&quot; was a single run of a workflow (think an object instance rather than a class). If I'd tried to apply a CronWorkflow, then <code>kubectl apply</code> would have worked. The error message that I got:</p>
<pre><code>error: from hello-world-: cannot use generate name with apply
</code></pre>
<p>Told me about it, but I didn't understand it at the time. This is invalid:</p>
<pre><code>apiVersion: argoproj.io/v1alpha1
kind: CronWorkflow
metadata:
  generateName: some-name
...
</code></pre>
<p>But this is valid:</p>
<pre><code>apiVersion: argoproj.io/v1alpha1
kind: CronWorkflow
metadata:
  name: some-name
...
</code></pre>
