Skip to content

DeleteNamespacedAsync hangs indefinitely #1631

Closed

Description

@justinmchase

Describe the bug
I am awaiting await generic.DeleteNamespacedAsync<T>(...) but it never returns.

Kubernetes C# SDK Client Version
16.0.7

Server Kubernetes Version
1.30.5

Dotnet Runtime Version
net8

To Reproduce

  1. Follow the CRD example app
  2. Create an instance of the CR in a namespace
  3. Delete it from the namespace
await generic.DeleteNamespacedAsync<CResource>(
  this.Namespace,
  tunnel.Metadata.Name,
  cancellationToken
);

Expected behavior

  1. The resource id deleted from kubernetes
  2. This method returns immediately after

KubeConfig
N/A

Where do you run your app with Kubernetes SDK (please complete the following information):

  • OS: Linux
  • Environment: container
  • Cloud: Docker Desktop

Additional context

I have a watcher going at the same time:

await foreach (var (eventType, resource) in generic.WatchNamespacedAsync<T>(this.Namespace, cancel: cancellationToken))

This is detecting the resource being deleted and it keeps operating fine without hanging, I can manually create and delete more resources in kube and this watcher responds as normal. I'm also calling a PatchNamespacedAsync<T> and that one returns fine, its specifically deletion thats appears to hang.

Activity

  1. tg123 commented on May 16, 2025

    @tg123
    Member

    i believe this is not an SDK issue

    kubectl will stuck as well when your finalizer of ns blocked you from deleting it.
    you can kubectl patch namespace yourns -p '{"metadata":{"finalizers":[]}}' --type=merge

  2. locked and limited conversation to collaborators on May 30, 2025
  3. converted this issue into a discussion #1637 on May 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions