<p>I have setup a kubernetes cluster with 2 <code>master</code> nodes and 4 <code>worker nodes</code>, I am trying to do an etcd backup
as described in the documentation inside my etcd container.</p>
<pre><code>‍ETCDCTL_API=3 etcdctl --endpoints=https://127.0.0.1:2379 \
  --cacert=&lt;trusted-ca-file&gt; --cert=&lt;cert-file&gt; --key=&lt;key-file&gt; \
  snapshot save &lt;backup-file-location&gt;
</code></pre>
<p>but I get the following error:</p>
<pre><code>Error: unknown command &quot;save&quot; for &quot;etcdctl&quot;
</code></pre>
<p>Are there something to concider upfront?</p>

pwoltschk
<p>Check first if this is similar to <a href="https://stackoverflow.com/q/70906419/6309">this question</a></p>
<blockquote>
<p>I forgot to set <code>$ENDPOINT</code>.</p>
</blockquote>
<p>That can happen if the <code>--endpoints</code> flag is not correctly followed by an actual endpoint.<br />
In your case, because of the lack of a specified endpoint after the <code>--endpoints</code> flag, <code>etcdctl</code> is interpreting &quot;<code>snapshot</code>&quot; as the endpoint, and &quot;<code>save</code>&quot; as the command - which could result in the error you are seeing.</p>
<p>A better formed command would be:</p>
<pre class="lang-bash prettyprint-override"><code>ETCDCTL_API=3 etcdctl --endpoints=https://127.0.0.1:2379 \
  --cacert=&lt;trusted-ca-file&gt; --cert=&lt;cert-file&gt; --key=&lt;key-file&gt; \
  snapshot save &lt;backup-file-location&gt;
</code></pre>
<p>Do replace <code>&lt;trusted-ca-file&gt;</code>, <code>&lt;cert-file&gt;</code>, <code>&lt;key-file&gt;</code>, and <code>&lt;backup-file-location&gt;</code> with your actual file paths.</p>
<p>The <code>--endpoints</code> flag specifies the endpoint to connect to your etcd server. In a Kubernetes cluster, you typically connect to the etcd server through localhost (127.0.0.1) on port 2379, which is the default etcd client port.</p>
<hr />
<p>Also, just in case, in some shells, using the <code>\</code> character for line continuation might cause issues, try running the command all on one line:</p>
<p><code>ETCDCTL_API=3 etcdctl --endpoints=https://127.0.0.1:2379 --cacert=&lt;trusted-ca-file&gt; --cert=&lt;cert-file&gt; --key=&lt;key-file&gt; snapshot save &lt;backup-file-location&gt;</code></p>
<p>Another issue might be that the <code>&lt;backup-file-location&gt;</code> you are specifying does not exist or the <code>etcdctl</code> does not have permission to write to it. Make sure the directory you are trying to save the snapshot to exists and that the user running the <code>etcdctl</code> command has permission to write to it.</p>
