Uploaded image for project: 'ONAP Operations Manager'
  1. ONAP Operations Manager
  2. OOM-1586

Add --force --grace-period=0 delete pod capability to cd.sh script

XMLWordPrintable

    • Icon: Task Task
    • Resolution: Done
    • Icon: Medium Medium
    • None
    • None
    • None

      need to be able to automatically purge stuck pods with

      ubuntu@onap-oom-obrien-rancher-e0:~$ kubectl get pods --all-namespaces
      NAMESPACE     NAME                                      READY     STATUS        RESTARTS   AGE
      kube-system   heapster-5c6fddd5b-xtvn2                  1/1       Running       0          21d
      kube-system   kube-dns-8587b597fc-6jqkn                 3/3       Running       9          21d
      kube-system   kubernetes-dashboard-79599f58bc-jw7gr     1/1       Running       0          21d
      kube-system   monitoring-grafana-74c4f86f9c-7j8c4       1/1       Running       0          21d
      kube-system   monitoring-influxdb-f78c85b98-4ktsq       1/1       Running       0          21d
      kube-system   tiller-deploy-b5f895978-sc2x6             1/1       Running       2          21d
      onap          onap-portal-portal-sdk-7c49c97955-smbws   0/2       Terminating   0          1d
      ubuntu@onap-oom-obrien-rancher-e0:~$ kubectl delete pod onap-portal-portal-sdk-7c49c97955-smbws -n onap --grace-period=0 --force
      
      

      those that dont respond to the normal

      kubectl delete namespace onap
      sudo helm delete --purge onap
      kubectl delete pv --all
      kubectl delete pvc --all
      kubectl delete secrets --all
      kubectl delete clusterrolebinding --all
      in
      https://wiki.onap.org/display/DW/Cloud+Native+Deployment#CloudNativeDeployment-RemoveaDeployment

      POC - will retrofit after I finish LOG-898 work

      kubectl get pods --all-namespaces -o json
      # we are looking to shutdown a rogue pod that is not responding to the normal deletion commands - but it contains a generated name
      onap          onap-portal-portal-sdk-7c49c97955-smbws   0/2       Terminating   0          2d
      ubuntu@onap-oom-obrien-rancher-e0:~$ kubectl get pods --field-selector=status.phase!=Running --all-namespaces
      NAMESPACE   NAME                                      READY     STATUS        RESTARTS   AGE
      onap        onap-portal-portal-sdk-7c49c97955-smbws   0/2       Terminating   0          2d
      
      #"spec": {"containers": [{},"name": "portal-sdk",
      kubectl get pods --namespace onap -o jsonpath="{.items[*].spec.containers[0].name}"
      portal-sdk
      # so combining the two queries
      kubectl get pods --field-selector=status.phase!=Running --all-namespaces -o jsonpath="{.items[*].metadata.name}"
      onap-portal-portal-sdk-7c49c97955-smbws
      # and wrapping it with a delete command
      
      export POD_NAME=$(kubectl get pods --field-selector=status.phase!=Running --all-namespaces -o jsonpath="{.items[*].metadata.name}")
      echo "$POD_NAME"
      kubectl delete pods $POD_NAME --grace-period=0 --force -n onap
      
      ubuntu@onap-oom-obrien-rancher-e0:~$ sudo ./term.sh 
      onap-portal-portal-sdk-7c49c97955-smbws
      warning: Immediate deletion does not wait for confirmation that the running resource has been terminated. The resource may continue to run on the cluster indefinitely.
      pod "onap-portal-portal-sdk-7c49c97955-smbws" force deleted
      

            michaelobrien michaelobrien
            michaelobrien michaelobrien
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: