kubernetes-sigs / kind

Kubernetes IN Docker - local clusters for testing Kubernetes
https://kind.sigs.k8s.io/
Apache License 2.0
13.35k stars 1.55k forks source link

multi-node vs single-node cluster #3646

Closed ehdis closed 3 months ago

ehdis commented 3 months ago

I'm not sure if its a general problem or a specific one. Furthermore I'm new to kind, so bear with me ...

I keep it intentionally short. The essence of the setup is:

so, a successfull test looks like

$ curl 192.168.122.82:28080
<html><body><h1>It works!</h1></body></html>

and indead (with extraPortMappings), on a single-node kind cluster - I can reach the service as shown above on the interface of my workstation (due to the extraPortMappings).

A two-node kind cluster

$ grep role   createCluster.yml 
- role: control-plane
- role: worker

with the mentioned httpd-service deployed does not work.

When I "exec/bash" into the worker container, I'm able to curl the pods (replicas: 2) or cluster IP and the expected result appears. When I "exec/bash" into the control-plane container, the same curl tests are not successful (they should or not?), and therefore of course the external port forward (workstation) does not work either.

What is necessary for the two nodes to pass the traffic? I would expect that the traffic would pass through the podman network handled by the nodes/containers.

$ kind version
kind v0.23.0 go1.22.2 (Red Hat 1.22.2-1.el9) linux/amd64
$ podman version
Version:      4.9.4-rhel

Thanks!

aojea commented 3 months ago

extraPortMappings need to map to the node where the pod is deployed

ehdis commented 3 months ago

This was definitely caused by yaml-fatigue. You are absolutely right. That mapping block must be associated to the worker declaration. Am I right in assuming that this is a fixed wiring, and in a multi-node setup the app of interest can only be run on one particular node (forced with label/selectors?)?

BenTheElder commented 3 months ago

Am I right in assuming that this is a fixed wiring, and in a multi-node setup the app of interest can only be run on one particular node (forced with label/selectors?)?

This is true for the workload exposing the port, however for example if you use an ingress then only the ingress needs to be on that node and the workload behind the ingress can be on other nodes.

FWIW If you're developing applications I generally recommend a single node cluster unless you have a use case involving multi-node rolling update behaviors.