<p>I am creating kubernetes secrets using the below command</p>
<pre class="lang-sh prettyprint-override"><code>kubectl create secret generic test-secret --save-config --dry-run=client --from-literal=a=data1 --from-literal=a=data2 -o yaml | kubectl apply -f -
</code></pre>
<p>Now, I need to add new literals using kubectl imperative command how to do that??
say eg:</p>
<pre class="lang-sh prettyprint-override"><code>kubectl apply secret generic test-secret  --from-literal=c=data3 -o yaml | kubectl apply -f - 
</code></pre>
<p>but gave the below error</p>
<p>Error: unknown flag: --from-literal
See 'kubectl apply --help' for usage.
error: no objects passed to apply</p>
<p>Any quick help is appreciated</p>

magic
<blockquote>
<p>add new literals using kubectl imperative command</p>
</blockquote>
<p>When working with <em>imperative commands</em> it typically means that you don't save the change in a place outside the cluster. You can <strong>edit</strong> a Secret in the cluster directly:</p>
<pre><code>kubectl edit secret test-secret
</code></pre>
<p>But if you want to <em>automate</em> your &quot;addition&quot;, then you most likely save your Secret another place before applying to the cluster. How to do this depends on how you manage Secrets. One way of doing it is by adding it to e.g. <a href="https://www.vaultproject.io/" rel="nofollow noreferrer">Vault</a> and then have it automatically injected. When working in an automated way, it is easier to practice <em>immutable</em> Secrets, and create new ones instead of mutating - because you typically need to redeploy your app as well, to make sure it uses the new. Using <a href="https://kubernetes.io/docs/tasks/configmap-secret/managing-secret-using-kustomize/" rel="nofollow noreferrer">Kustomize with secretGenerator</a> might be a good option if you work with immutable Secrets.</p>
