Skip to content

Spark CR deletion leaves orphaned pods #701

Closed

Description

@Maleware

Affected Stackable version

26.3.0

Affected Apache Spark-on-Kubernetes version

all

Current and expected behavior

Before 26.3

CR held owner reference onto driver and driver onto executer which lead to deletion of pods when deleting the CR. It was convenient since reinstalling the SparkApp requires to delete the old CR.

After 26.3

CR doesn't have owner reference on driver pod, driver still owns the executer. Means, deleting the CR now leaves driver and executer untouched and thus run uncontrolled until manually deletion. The operator auto deletes the driver pod once it reaches "terminating" phase which might not happen during uninstalls e.g.

Proposal

Deleting a CR purposefully should lead to the product being uninstalled. Maybe finalizer on the SparkApplication can help. We could on deletionTimestamp delete the driver pod which then cascades to the executer due to ownerRef. This would preserve the behaviour that if driver reaches terminating, it gets cleaned up by the operator and thus its executor.

Possible solution

No response

Additional context

No response

Environment

No response

Would you like to work on fixing this bug?

None

Activity

  1. added theissue type on Jun 16, 2026
  2. Maleware commented on Aug 26, 2026

    @Maleware
    MemberAuthor

    A note on that:

    I'm currently after a Jira issue of a customer running in exactly that. I've got a try for a fix, currently testing.

    However, I figured when reinstalling the operator (carring the fix) pods without a CR (as a current cluster state could be) won't be cleaned up and rather a constant error is thrown:

    15:21:34 INFO  Starting reconcile driver pod
    15:21:34 ERROR ... Spark application [long-running] not found ... NotFound
    15:21:39 INFO  ... object.reason=error policy requested retry
    15:21:44 ERROR ... Spark application [long-running] not found
    15:21:49 INFO  Starting reconcile driver pod
    

    This will be retried forever since

    let app = client.get::<v1alpha1::SparkApplication>(app_name, ns)
        .await
        .context(SparkApplicationNotFoundSnafu { name: app_name.clone() })?;
    

    I might make another issue out of that, leave it here so I won't forget at least.

  3. lfrancke commented on Nov 11, 2026

    @lfrancke
    Member

    Fixed by #758: the driver Pod now has an owner reference, so deleting a SparkApplication also removes its driver and executor Pods. The fix ships with 26.11. Please reopen if Pods are left behind after that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions