<p>I am using Docker for Mac but currently only using it for its Kubernetes cluster. The Kubernetes cluster's single node is named <strong>docker-for-desktop</strong>.</p>

<p>I'm currently going through a Kubernetes tutorial on Persistent Volumes (<a href="https://kubernetes.io/docs/tasks/configure-pod-container/configure-persistent-volume-storage/" rel="noreferrer">https://kubernetes.io/docs/tasks/configure-pod-container/configure-persistent-volume-storage/</a>) and as part of that, I'm setting up a <strong>hostPath</strong> persistent volume. It seems like the way this works is, you create a path on the Kubernetes Node itself and you can use that as your persistent volume for development and testing purposes.</p>

<p>To do that, the tutorial instructs you to SSH into your Kubernetes node itself and create a path which can then be turned into a persistent volume. The only problem is, I have no idea how to SSH directly into the Kubernetes node itself (not a container). The equivalent for minikube would just be <code>minikube ssh</code>. I can <code>kubectl describe</code> the node, but I only get an internal IP address, not an external one. So I have no idea how to address it in an <code>ssh</code> command.</p>

<p>Any ideas?</p>

Stephen
<p>Comment in the OP should get credit for this but i'll add again so i find it easier in a few months:</p>

<pre><code>docker run -it --rm --privileged --pid=host justincormack/nsenter1
</code></pre>

<p>From <a href="https://github.com/justincormack/nsenter1/blob/master/README.md" rel="noreferrer">https://github.com/justincormack/nsenter1/blob/master/README.md</a></p>

<blockquote>
  <p>... this is useful when you are running a lightweight, container-optimized Linux distribution such as LinuxKit... you are demonstrating with Docker for Mac, for example, your containers are not running on your host directly, but are running instead inside of a minimal Linux OS virtual machine specially built for running containers, i.e., LinuxKit. But being a lightweight environment, LinuxKit isn't running sshd, so how do you get access to a shell so you can run nsenter to inspect the namespaces for the process running as pid 1?</p>
</blockquote>
