It is tricky to find the optimal number of clusters and depends on many aspects. There is no node in KNIME which performs one of the methods you have mentioned above, but you could build a workflow for it. You may take a look at this post where a user had a similar question:
Yes we already have such a node on out list for a future release, it would be a really nice new node. However, I cannot make promises in which release we will manage to add this node.
The topic @izaychik63 linked to contains a link to a extension which seems to do what you are searching for. I don’t know the extension and it is not a trusted KNIME Community extension, so you are free to use it of course, but I cannot ensure any correct functionality. Thanks for the link, though, @izaychik63.
If the extension does not provide what you are searching for, using R might be the easiest solution for now.
The workflow in examples server doesn’t have this bug. The number of clusters in K-Means node is read from the variable.
Thank you everybody. I hope we’ll have the new node for determining the optimal number of clusters in KNIME soon.