Skip to content

How to use this python client to delete existed pod? #1044

@nettyxiong

Description

@nettyxiong

I use the follows code to delete pod and use a loop to check it if exists. But I find that I can always get pod info although the pod would no be seen in the dashboard. I don't know how to prove that pod has already been deleted.

def delete_pod(api_instance):
    name = 'test'
    namespace = 'default'
    api_response = api_instance.delete_namespaced_pod(name, namespace)
    time.sleep(5)

    resp = None

    while True:
        resp = api_instance.read_namespaced_pod_status(name, namespace)
        print resp
        if not resp:
            print 'Has been deleted successfully...'
            break
        time.sleep(1)

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/documentationCategorizes issue or PR as related to documentation.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions