<p>does anyone know if this is possible?</p>
<p>All I can find in docs is reference to enabling docker experimental features, but not the kubernetes experimental features.</p>
<p>I tried this, but still get error.</p>
<pre><code>k alpha debug -it exchange-pricing-865d579659-s8x6d --image=busybox --target=exchange-pricing-865d579659-s8x6d
error: ephemeral containers are disabled for this cluster (error from server: &quot;the server could not find the requested resource&quot;).
</code></pre>
<p>Thanks</p>

Damo
<p>I had the same intent (as have others in <a href="https://github.com/docker/for-mac/issues/2382" rel="nofollow noreferrer">this feature request</a>). After several hours of trial and error, I finally found out a way to do so.</p>
<p>Steps:</p>
<ol>
<li>Depending on which file you're trying to edit, you may need to fully shut down Docker Desktop, and restart WSL. (right-click tray-icon and press &quot;Quit Docker Desktop&quot;, then run <code>wsl --shutdown</code>, then run <code>wsl</code>)</li>
<li>Open the <code>[...]/kubeadm/manifests</code> folder, in the Docker filesystem.</li>
</ol>
<blockquote>
<p>On Windows, navigate Windows Explorer to:</p>
<ul>
<li>For Docker Desktop 4.2.0: <code>\\wsl$\docker-desktop-data\version-pack-data\community\kubeadm\manifests</code></li>
<li>For Docker Desktop 4.11.0: <code>\\wsl$\docker-desktop-data\data\kubeadm\manifests</code></li>
</ul>
</blockquote>
<ol start="3">
<li>Open the <code>kube-controller-manager.yaml</code>, <code>kube-apiserver.yaml</code>, and <code>kube-scheduler.yaml</code> files, adding the line below:</li>
</ol>
<pre><code>spec:
  containers:
  - command:
    [...]
    - --feature-gates=EphemeralContainers=true     &lt;-- add this line
</code></pre>
<ol start="4">
<li>Start Docker Desktop again.</li>
</ol>
<p>It looks so easy when its already figured out, huh? Well trust me, it was a pain to find out.</p>
<p>Some of the slowdowns I hit:</p>
<ol>
<li>It took me quite a while to even find those manifest files. (eventually found it using <a href="https://tools.stefankueng.com/grepWin.html" rel="nofollow noreferrer">grepWin</a>, searching through the whole <code>\\wsl$\docker-desktop-data</code> folder for any matches of a line I grabbed from the <code>kube-apiserver-docker-desktop</code> pod's config, which I viewed using <a href="https://k8slens.dev/" rel="nofollow noreferrer">Lens</a>)</li>
<li>Once I found it, I got confused by <a href="https://kubernetes.io/docs/concepts/workloads/pods/ephemeral-containers/#ephemeral-containers-api" rel="nofollow noreferrer">this documentation</a>. When I read <code>FEATURE STATE: Kubernetes v1.22 [alpha]</code>, I thought that meant you needed version 1.22 or higher of Kubernetes for the feature to be available. This caused a huge wild goose chase where I tried to change the version of Kubernetes that was being launched in Docker Desktop, which Docker Desktop didn't seem to like. (in retrospect, the issue may have just been the minor one in point 3 below...)</li>
<li>When I first made changes to the manifest files, I was using Notepad++. And despite my liking Notepad++, it's apparently not quite as smart as vscode in the following regard: it does not automatically detect the indentation type for yaml files. Thus, when I pressed tab to create an indent, so I could add the new flag to the argument list, it added it as a tab character rather than spaces. This caused Kubernetes to fail reading of the file. That might not be so bad if Kubernetes gave a sane error message for that, but instead it merely gave the message <code>unexpected EOF</code>. And I didn't even see that error message at first because it was not being propagated to the <code>kube-controller-manager-docker-desktop</code> pod (which was the only relevant one that wasn't immediately erroring/closing). Anyway, I didn't realize this was the problem at the time, so...</li>
<li>I decided to try bypassing the manifest-files and applying my modification to the etcd data-store directly. In retrospect, this was not a good idea, because the etcd data-store is pretty complex, the tooling is substandard, and the documentation is substandard. I spent a ton of time just trying to figure out how to send commands to read and write data to it (eventually managed to do so by calling <code>etcdctl</code> within the <code>etcd-docker-desktop</code> pod). I spent further time still writing up a NodeJS script capable of reading all the data as JSON, storing it in a dump file, and being able to write changes to entries back despite there being 3+ levels of quoting involved (I eventually was able to use <code>stdin</code> to pass the value rather than as part of the command string, to avoid quotation-mark-inception). After all the work on etcd reading/writing above, I found it didn't work anyway because Kubernetes invariably &quot;breaks&quot; if anyone else writes to its etcd data-store. (even if you write the exact same value that had been there before -- as verified by comparing the dumps before and after)</li>
<li>After all of the above, I decided to have one last go with just adding the flags to mentioned manifest files. Was still getting the startup failure/error, but at the very end, I decided I wanted to see exactly what about my changes was causing Kubernetes to reject them. So I tried commenting out my added line; the error remained. I thought maybe it was a checksum-based rejection then. But then I thought, maybe the YAML parser that Kubernetes is using is just outdated and is finicky about what comments it is able to recognize. So I tried moving the comment around to different places, and was puzzled when the manifest was being accepted just by moving the comment to the root level. I moved it back to various locations, with it working and not working, until I thought to try making the line &quot;half-indented&quot; since it's &quot;in-between&quot; the working and non-working versions. That's when I noticed the line had a tab as its indent. And then it hit me; are the other lines also using tabs? I checked, and nope, they were using spaces. And that's when I realized I had wasted the last few hours on something I coulda just fixed with a simple indent change.</li>
</ol>
<p>The moral of the story for some is that YAML is a bad configuration format, because it makes it easy to make trivial errors like this. But I actually place the blame more on whatever parser Kubernetes is using for the YAML files; it is unacceptable that a YAML parser would encounter an indentation mismatch and give a message so generic as <code>unexpected EOF</code>. I don't know what the identity of that YAML parser is, but I'm tired enough of the subject that I'm not even going to look into it right now. If one of you finds it, please make an issue report for it -- perhaps including this story as a real-world example of the pain that ambiguous error messages can cause.</p>
