Skip to content

Let ECK diagnostics understand if K8s doesn't have a running ECK environment #341

@kunisen

Description

@kunisen

Description

It would be very helpful to understand if a user is running ECK or a pure Elastic stack on K8s (without ECK operator manages).

I raised the issue here per request from @pebrc via internal sync.

Additional Notes

Currently we have something close already,

eck-diagnostics -o elastic-system -r default 

2025/08/14 09:41:07 ECK diagnostics with parameters: {DiagnosticImage:docker.elastic.co/eck-dev/support-diagnostics:9.3.1 ECKVersion: Kubeconfig: OperatorNamespaces:[elastic-system] ResourcesNamespaces:[default] OutputDir: OutputName:eck-diagnostics-2025-08-14T09-41-07.zip RunStackDiagnostics:true RunAgentDiagnostics:false Verbose:false StackDiagnosticsTimeout:5m0s Filters:map[] LogFilters:map[]}
Error: namespaces "elastic-system" not found

This is the current output on a cluster where ECK is not installed

If the user then sets both parameters to default the output is:

eck-diagnostics -o default -r default

2025/08/14 09:41:51 ECK diagnostics with parameters: {DiagnosticImage:docker.elastic.co/eck-dev/support-diagnostics:9.3.1 ECKVersion: Kubeconfig: OperatorNamespaces:[default] ResourcesNamespaces:[default] OutputDir: OutputName:eck-diagnostics-2025-08-14T09-41-51.zip RunStackDiagnostics:true RunAgentDiagnostics:false Verbose:false StackDiagnosticsTimeout:5m0s Filters:map[] LogFilters:map[]}
2025/08/14 09:41:51 Could not find label corresponding to ECK Operator in namespace default: potentially not including operator data in diagnostics
2025/08/14 09:41:51 operator statefulset not found, checking for OLM deployment but failed: deployments.apps "elastic-operator" not found
2025/08/14 09:41:51 ECK version is unknown
2025/08/14 09:41:51 Extracting Kubernetes diagnostics from default
I0814 09:41:51.781014   35057 warnings.go:110] "Warning: v1 Endpoints is deprecated in v1.33+; use discovery.k8s.io/v1 EndpointSlice"
2025/08/14 09:41:51 the server doesn't have a resource type "elasticsearch"
2025/08/14 09:41:51 ECK diagnostics written to eck-diagnostics-2025-08-14T09-41-51.zip

This will actually create an archive with some data but also a bunch of errors:

[the server doesn't have a resource type "podsecuritypolicies", the server doesn't have a resource type "kibana", the server doesn't have a resource type "elasticsearch", the server doesn't have a resource type "apmserver", the server doesn't have a resource type "enterprisesearch", the server doesn't have a resource type "beat", the server doesn't have a resource type "agent", the server doesn't have a resource type "elasticmapsserver", the server doesn't have a resource type "logstash"]

But IMHO it's not visibly enough to let all users understand that. We could improve this, for example:

  • Error: namespaces "elastic-system" not found, add a message e.g. This means ECK operator is installed in a different namespace or ECK Operator does not exist.
  • Re Could not find label corresponding to ECK Operator in namespace default: potentially not including operator data in diagnostics, add a message e.g. This means ECK operator is installed in a different namespace or ECK Operator does not exist.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions