<p>I want to start a server and a client using
<code> docker run rancher/k3s:latest server</code> and
<code> docker run -e K3S_TOKEN=xyz -e K3S_URL=https://&lt;server_container_name&gt;:6443 rancher/k3s:latest agent</code></p>
<p>But for some reason, the server and the client aren't able to communicate with each other even if I deploy it on a separate network. Any suggestions as to what can be done?</p>

mitra
<p>Starting your first server, you would want to expose ports. Eg:</p>
<pre><code>docker run -p 6443:6443 ranger/k3s:latest server
</code></pre>
<p>Then, make sure the other container can resolve the FQDN for your K3S_URL, sending this to the host address where your initial server was started on. Eg:</p>
<pre><code>docker run --add-host &lt;server_name&gt;:&lt;ip-address&gt; \
    -e K3S_TOKEN=xyz -e K3S_URL=https://&lt;server_name&gt;:6443 \
    rancher/k3s:latest agent
</code></pre>
<p>Also note: in my case, I also had to add the <code>--privileged</code> docker option, and some <code>--snapshotter native</code> option</p>
<pre><code>docker run --privileged -p 6443:6443 rancher/k3s:latest server --snapshotter native
docker run --privileged -e K3S_TOKEN=xxx --add-host=adcbd2a250ff:10.42.42.127 -e K3S_URL=https://adcbd2a250ff:6443 rancher/k3s:latest agent --snapshotter native
</code></pre>
