k3s-io/k3s · error

Managed etcd cluster membership was previously reset, please

Error message

Managed etcd cluster membership was previously reset, please remove the cluster-reset flag and start %s normally. If you need to perform another cluster reset, you must first manually delete the file at %s

What it means

k3s guards against accidental repeated resets of the managed (embedded etcd) datastore. A successful `--cluster-reset` writes a reset-flag file (managedDB.ResetFile(), default /var/lib/rancher/k3s/server/db/reset-flag). On the next startup with `--cluster-reset` still set and no `--cluster-reset-restore-path`, startup aborts with this error instead of wiping etcd membership again.

Source

Thrown at pkg/cluster/managed.go:54

	resetDone, err := c.managedDB.IsReset()
	if err != nil {
		return err
	}

	if c.config.ClusterReset {
		// If we're restoring from a snapshot, don't check the reset-flag - just reset and restore.
		if c.config.ClusterResetRestorePath != "" {
			return c.managedDB.Reset(ctx, wg, rebootstrap)
		}

		// If the reset-flag doesn't exist, reset. This will create the reset-flag if it succeeds.
		if !resetDone {
			return c.managedDB.Reset(ctx, wg, rebootstrap)
		}

		// The reset-flag exists, ask the user to remove it if they want to reset again.
		return fmt.Errorf("Managed etcd cluster membership was previously reset, please remove the cluster-reset flag and start %s normally. "+
			"If you need to perform another cluster reset, you must first manually delete the file at %s", version.Program, c.managedDB.ResetFile())
	}

	if resetDone {
		// If the cluster was reset, we need to delete the node passwd secret in case the node
		// password from the previously restored snapshot differs from the current password on disk.
		c.config.Runtime.ClusterControllerStarts["node-password-secret-cleanup"] = c.deleteNodePasswdSecret
	}

	// Starting the managed database will clear the reset-flag if set
	return c.managedDB.Start(ctx, wg, c.clientAccessInfo)
}

// registerDBHandlers registers managed-datastore-specific callbacks, and installs additional HTTP route handlers.
// Note that for etcd, controllers only run on nodes with a local apiserver, in order to provide stable external
// management of etcd cluster membership without being disrupted when a member is removed from the cluster.
func (c *Cluster) registerDBHandlers(handler http.Handler) (http.Handler, error) {
	if c.managedDB == nil {

View on GitHub (pinned to 6ba341e396)

Solutions

  1. Remove `--cluster-reset` from the CLI flags / config file and start k3s normally - the previous reset already took effect.
  2. If another reset is truly needed, delete the reset-flag file at the path printed in the error (default /var/lib/rancher/k3s/server/db/reset-flag), then start with --cluster-reset again.
  3. If the intent was to restore from a snapshot, pass --cluster-reset-restore-path=<snapshot> - the restore path bypasses the reset-flag check entirely.

Example fix

# before
ExecStart=/usr/local/bin/k3s server --cluster-init --cluster-reset

# after
ExecStart=/usr/local/bin/k3s server --cluster-init
# (only if another reset is required: rm /var/lib/rancher/k3s/server/db/reset-flag first)
Defensive patterns

Strategy: validation

Validate before calling

// Before starting k3s with --cluster-reset, check the reset-flag file:
resetFlag := filepath.Join(dataDir, "server", "db", "reset-flag") // default /var/lib/rancher/k3s/server/db/reset-flag
if _, err := os.Stat(resetFlag); err == nil {
    fmt.Printf("cluster was already reset; remove %s before resetting again, or drop --cluster-reset\n", resetFlag)
    os.Exit(1)
}

Prevention

When it happens

Trigger: Starting k3s server a second consecutive time with config.ClusterReset=true while the reset-flag file exists and ClusterResetRestorePath is empty (pkg/cluster/managed.go:47-55).

Common situations: Operator leaves `--cluster-reset` in the systemd unit or config file after the first reset; automation that passes --cluster-reset on every start; re-running reset to 'fix' something without deleting the flag file.

Related errors


AI-assisted analysis of k3s-io/k3s@6ba341e396 (2026-08-15). Data as JSON: /api/errors/c8c1597e3c1e86c2. Report an issue: GitHub.