Kind: Allow port ranges in extraPortMappings

Created on 2 Jan 2020  路  6Comments  路  Source: kubernetes-sigs/kind

I work on an ingress controller called Voyager. I want to use kind for e2e testing instead of minikube.

The tests follow this pattern:

  1. I run the operator inside a cluster (minikube now, looking to switch to kind)
  2. Then run go test
  3. Tests will create an ingress resource which is exposed via a NodePort service. In minikube, I can access the ingress paths via $(minikube ip):nodeport. I would like to do the same with kind. But the problem is that I don't know the nodeport ahead of time.

If the extraPortMappings support port range, I could potentially use a single node kind cluster that forwards the default k8s nodeport range.

Do you think this can be supported? Is there any other alternative ideas?

kinfeature

Most helpful comment

If the extraPortMappings support port range, I could potentially use a single node kind cluster that forwards the default k8s nodeport range.

Are there any plans to support this feature?

I am actually interested in seeing this feature in kind, as I am using kind with docker-for-mac.
Thus, using NodePort services and extraPortMappings is my best option to expose k8s services for access (via localhost) from the host machine.

Still, if you want to use this approach for exposing services, you would need to know the assigned NodePort before creating the kind cluster to specify it in the cluster config. Therefore, setting the service's nodePort field to a specific number is the best solution I have for now, which is kind of cumbersome in my use-case, where Services are created in an automated fashion and get assigned random nodePorts from the kubelets nodePort range.

Long story short, it would be really nice to be able to expose the whole nodePort range in the kind cluster beforehand and not worrying about patching services inside the cluster.

All 6 comments

If you are using linux you can reach the services using the KIND nodes ips

Ah! I did not know this. This solves my use-case.

Ah! I did not know this. This solves my use-case.

/close per last comment
Thanks for your feedback, there are also some examples on the github issues and the official docs exposing nodeports with KIND like this https://kind.sigs.k8s.io/docs/user/resources/#using-contour-ingress-with-kind

/close

@aojea: Closing this issue.

In response to this:

/close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

If the extraPortMappings support port range, I could potentially use a single node kind cluster that forwards the default k8s nodeport range.

Are there any plans to support this feature?

I am actually interested in seeing this feature in kind, as I am using kind with docker-for-mac.
Thus, using NodePort services and extraPortMappings is my best option to expose k8s services for access (via localhost) from the host machine.

Still, if you want to use this approach for exposing services, you would need to know the assigned NodePort before creating the kind cluster to specify it in the cluster config. Therefore, setting the service's nodePort field to a specific number is the best solution I have for now, which is kind of cumbersome in my use-case, where Services are created in an automated fashion and get assigned random nodePorts from the kubelets nodePort range.

Long story short, it would be really nice to be able to expose the whole nodePort range in the kind cluster beforehand and not worrying about patching services inside the cluster.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

anjiawei1991 picture anjiawei1991  路  34Comments

carlisia picture carlisia  路  31Comments

wilmardo picture wilmardo  路  29Comments

nicks picture nicks  路  31Comments

BenTheElder picture BenTheElder  路  30Comments