<p>Following <a href="https://kind.sigs.k8s.io/docs/user/local-registry/" rel="nofollow noreferrer">this tutorial</a> to connect a local docker registry to the KIND cluster there's the below chunk of code in the bash script. I want to use my config file, but I don't know how the below chunk fits in (there's a lot of dashes and pipes in the syntax).</p>
<pre><code>cat &lt;&lt;EOF | kind create cluster --config=-
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
containerdConfigPatches:
- |-
  [plugins.&quot;io.containerd.grpc.v1.cri&quot;.registry.mirrors.&quot;localhost:${reg_port}&quot;]
    endpoint = [&quot;http://${reg_name}:${reg_port}&quot;]
EOF
</code></pre>
<p>My config file:</p>
<pre><code>kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
  extraPortMappings:
  - containerPort: 8080
    hostPort: 80
    protocol: TCP
- role: worker
- role: worker
- role: worker
- role: worker
</code></pre>

<p>In the shell fragment you show, everything between the first and last lines, including the dashes and pipes, is a valid YAML file; the only processing the shell does is replacing <code>${reg_name}</code> and <code>${reg_port}</code> with the values of the corresponding environment variables.</p>
<p>If you want to merge this with your existing kind config file, you should be able to just combine the top-level keys:</p>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: kind.x-k8s.io/v1alpha4
kind: Cluster
nodes:
- role: control-plane
  et: cetera
containerdConfigPatches:
- |-
  [plugins.&quot;io.containerd.grpc.v1.cri&quot;.registry.mirrors.&quot;localhost:5000&quot;]
    endpoint = [&quot;http://kind-registry:5000&quot;]
</code></pre>
<p>If you had other <code>containerdConfigPatches</code>, the sequence of items starting with <code>-</code> on each line is a YAML list (like you have in <code>nodes:</code>) and you could add this patch to the end of the list.  (This is a little unlikely since this option isn't documented in the <a href="https://kind.sigs.k8s.io/docs/user/configuration/" rel="nofollow noreferrer">kind Configuration documentation</a>.)</p>
