<p>I have a Bitnami WordPress helm release, I need to browse the files and edit some from the persistent volumes it created. Ideally I'd be able to browse the files using a GUI (like Nautilus/GNOME files) and edit the files using VS Code for ease of use.</p>
<p>Should I edit the files from within a mounted container? How can I do that? Are there other ways to go about this?</p>

Nomnom
<p>Before all I should mention that everything below is for development environment.
Do not think of doing manual changes into container apps in production. For production you should make it so that all the necessary changes are applied automatically.</p>
<h3>Copy files from remote machine and back</h3>
<pre class="lang-bash prettyprint-override"><code># Copy TO local machine
kubectl cp &lt;namespace_name&gt;/&lt;pod_name&gt;:&lt;remote_file_path&gt; &lt;local_file_path&gt; -c &lt;container_name&gt;

# Copy FROM local machine
kubectl cp &lt;local_file_path&gt; &lt;namespace_name&gt;/&lt;pod_name&gt;:&lt;remote_file_path&gt; -c &lt;container_name&gt;

# More examples
kubectl cp --help
</code></pre>
<p><code>-c &lt;container_name&gt;</code> can be omitted if there's only one container in the pod.</p>
<p>If you unsure which <code>&lt;namespace_name&gt;</code> or <code>&lt;pod_name&gt;</code> to use, you can try figuring that out with <code>kubectl get pods --all-namespaces</code>.</p>
<p>If you are unsure which remote path you should type, you can try using <code>ls</code> and <code>pwd</code> in remote container:</p>
<pre class="lang-bash prettyprint-override"><code>kubectl exec -n &lt;namespace_name&gt; &lt;pod_name&gt; -c &lt;container_name&gt; ls &lt;remote_path&gt;` 
# e.g.
kubectl exec -n my_namespace my_pod -c wordpress ls /var/www
kubectl exec -n my_namespace my_pod -c wordpress pwd
</code></pre>
<h3>Edit files remotely with a console editor</h3>
<p>Works if your container image has a shell in it and main process started by <code>root</code> user. Start console session with:</p>
<pre class="lang-bash prettyprint-override"><code>kubectl exec -it -n &lt;namespace_name&gt; &lt;pod_name&gt; -c &lt;container_name&gt; sh
</code></pre>
<p>Install some console text editor (vim, nano, etc.) and use it. How to install depends on what Linux was used as the base for the image, you can find out using <code>cat /etc/os-release</code>.</p>
<h3>Editing with GUI</h3>
<p>One way to work with GUI that I see, is to launch a web-based text editor (like <code>jupyter</code>) alongside the app. You would need to modify the Deployment (or StatefulSet, DaemonSet, etc) and then you can launch proxy to the new container.</p>
<p>Here's an example how to add <code>jupyter</code> to a pod:</p>
<ol>
<li>Modify the deployment by adding jupyter container:</li>
</ol>
<pre class="lang-yaml prettyprint-override"><code>- name: jupyter
  image: jupyter/base-notebook
  securityContext:
    runAsUser:  # insert UID that uses your app
  args:
  - jupyter
  - notebook
  - --ip=0.0.0.0
  - --allow-root # if the UID is 0
  workingDir: /data
  ports:
  - containerPort: 8888
  volumeMounts:
    - mountPath: /data
      name: # insert name of the volume with files you want to modify
</code></pre>
<ol start="2">
<li>Use <code>kubectl port-forward</code> to establish a connection with the pod:</li>
</ol>
<pre><code>kubectl port-forward -n &lt;namespace&gt; &lt;pod_name&gt; 8888:8888
</code></pre>
<p>After that you can access jupyter on <code>localhost:8888</code>. See jupyter logs to obtain the access key (<code>kubectl logs -n &lt;namespace&gt; &lt;pod_name&gt; -c jupyter</code>).</p>
