cloud-on-k8s icon indicating copy to clipboard operation
cloud-on-k8s copied to clipboard

Cluster non-bootable with nodeSet setting config.discovery.type: single-node

Open mikkeldamsgaard opened this issue 1 year ago • 1 comments

With this setting in the Elasticsearch resource

spec:
  nodeSets:
    - count: 1
      config:
        discovery.type: single-node

the cluster becomes non-bootable, as the controller will patch the initial_master_nodes on the nodes and that is not supported with discovery.type single-node.

The expectation is that it is possible to set the discory.type to single-node

  • ECK version: 2.11.1

  • Kubernetes information: AWS EKS version 1.28

  • Logs: The logs wrote a fatal error that single-node discovery.type is incompatible with cluster.initial_master_nodes

Looking at the code, it seems that no matter what, the zen2 .initial_master_nodes.go will patch the nodeSets.config to include the initial_master_nodes. I did not find a workaround for this.

However, maybe a small correction to the function, like this could help this situation?

// patchInitialMasterNodesConfig mutates the configuration of zen2-compatible master nodes
// to have the given `cluster.initial_master_nodes` setting.
func patchInitialMasterNodesConfig(ctx context.Context, nodeSpecResources nodespec.ResourcesList, initialMasterNodes []string) error {
	for i, res := range nodeSpecResources {
		if !label.IsMasterNodeSet(res.StatefulSet) || !IsCompatibleWithZen2(ctx, res.StatefulSet) {
			// we only care about updating zen2 masters config here
			continue
		}
		if !isSingleNode(nodeSpecResources[i].Config) {
			if err := nodeSpecResources[i].Config.SetStrings(esv1.ClusterInitialMasterNodes, initialMasterNodes...); err != nil {
				return err
			}
		}
	}
	return nil
}

func isSingleNode(config settings.CanonicalConfig) bool {
	val, err := config.String(esv1.DiscoveryType)
	if err != nil {
		return false
	}
	return val == "single-node"
}

mikkeldamsgaard avatar Jun 14 '24 12:06 mikkeldamsgaard

I am trying to understand what the use case for this would be. You can create a single node cluster without setting the discovery.type to single-node. Can you exlain?

pebrc avatar Nov 29 '24 14:11 pebrc

I'm going to close this until further information is provided, such as the use case for this setting, since you can just get a single-node cluster with a manifest such as:

spec:
  nodeSets:
    - name: test
      config:
        node.roles:
          - master
          - data
          - ingest
      count: 1

naemono avatar Jul 02 '25 17:07 naemono