crowdsecurity/crowdsec · error

unsupported mode %q in kubernetes acquisition, only %q is su

Error message

unsupported mode %q in kubernetes acquisition, only %q is supported

What it means

Returned by Configuration.Validate when the kubernetes acquisition 'mode' is set to anything other than the only supported value (tail mode, the default). The offending input is the mode key in the kubernetes acquisition config.

Source

Thrown at pkg/acquisition/modules/kubernetes/config.go:66

	if c.Mode == "" {
		c.Mode = configuration.TAIL_MODE
	}
	if c.KubeConfigFile == "" {
		if home, err := os.UserHomeDir(); err == nil {
			c.KubeConfigFile = filepath.Join(home, ".kube", "config")
		}
	}
}

func (c *Configuration) Validate() error {
	if c.Selector == "" {
		return errors.New("selector must be set in kubernetes acquisition")
	}
	if _, err := labels.Parse(c.Selector); err != nil {
		return fmt.Errorf("invalid selector %q in kubernetes acquisition: %w", c.Selector, err)
	}
	if c.Mode != configuration.TAIL_MODE {
		return fmt.Errorf("unsupported mode %q in kubernetes acquisition, only %q is supported", c.Mode, configuration.TAIL_MODE)
	}
	return nil
}

func (s *Source) UnmarshalConfig(yamlConfig []byte) error {
	cfg, err := ConfigurationFromYAML(yamlConfig)
	if err != nil {
		return err
	}

	if s.logger != nil {
		s.logger.Tracef("Kubernetes configuration: %+v", cfg)
	}

	s.config = cfg
	s.client = nil
	s.cancels = nil

View on GitHub (pinned to 909b515798)

Solutions

  1. Set mode: tail in the acquisition yaml, or omit mode (defaults to tail)
  2. Remove unsupported mode values such as cat or oneshot
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at pkg/acquisition/modules/kubernetes/config.go:66 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of crowdsecurity/crowdsec@909b515798 (2026-09-06). Data as JSON: /api/errors/4ba34a59d1d1e81d. Report an issue: GitHub.