<p>I would like to run an application in local cluster for development purposes with <code>kind</code> using <code>docker</code>. Based on the description <code>https://kind.sigs.k8s.io/docs/user/quick-start/</code> I defined the cluster</p>
<pre><code>kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
- role: worker
  extraPortMappings:
    - containerPort: 30000
      hostPort: 5432
      protocol: TCP
</code></pre>
<p>and the deployment with container:</p>
<pre><code>        containers:
        - name: postgres
          image: postgres:14.0
          ports:
            - containerPort: 5432
</code></pre>
<p>and the service</p>
<pre><code>apiVersion: v1
kind: Service
metadata:
  name:  database
spec:
selector:
  name:  app
type:  NodePort
ports:
- name:  postgres
  port:  5432
  targetPort:  5432
  nodePort: 30000
</code></pre>
<p>which I assumed should allow me to connect with dbeaver from my windows 11 host. This looks to be not working so I would like to ask, how should I configure that to being able to access it from host. What I have already tried is: <code>localhost:30000, 127.0.0.1:30000</code> and also <code>127.0.0.1:5432, localhost:5432</code></p>
<p>Also <code>kubectl get services</code> command tells me that:</p>
<p><code>Type: NodePort, Port(S): 5432:30000/TCP, External-IP: &lt;none&gt;, Cluster-Ip:10.96.211.69, name:something</code></p>

Puchacz
<p>I found a solution, I turned out to be that I placed <code>extractPortMappings</code> inside <code>worker</code> node instead of <code>control-plane</code>. It's weird that it doesn't fail but after moving this part to correct place it started to work!</p>
<p>So the solution is to change to this:</p>
<pre><code>kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
  extraPortMappings:
  - containerPort: 30000
    hostPort: 5432
    protocol: TCP
- role: worker
</code></pre>
