{"action":"created","issue":{"url":"https://api.github.com/repos/kubernetes/kubernetes/issues/16337","labels_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/16337/labels{/name}","comments_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/16337/comments","events_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/16337/events","html_url":"https://github.com/kubernetes/kubernetes/issues/16337","id":113482867,"number":16337,"title":"Runlevel events for cluster","user":{"login":"bprashanth","id":10927820,"avatar_url":"https://avatars.githubusercontent.com/u/10927820?v=3","gravatar_id":"","url":"https://api.github.com/users/bprashanth","html_url":"https://github.com/bprashanth","followers_url":"https://api.github.com/users/bprashanth/followers","following_url":"https://api.github.com/users/bprashanth/following{/other_user}","gists_url":"https://api.github.com/users/bprashanth/gists{/gist_id}","starred_url":"https://api.github.com/users/bprashanth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bprashanth/subscriptions","organizations_url":"https://api.github.com/users/bprashanth/orgs","repos_url":"https://api.github.com/users/bprashanth/repos","events_url":"https://api.github.com/users/bprashanth/events{/privacy}","received_events_url":"https://api.github.com/users/bprashanth/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/kubernetes/kubernetes/labels/area/cluster-lifecycle","name":"area/cluster-lifecycle","color":"d4c5f9"},{"url":"https://api.github.com/repos/kubernetes/kubernetes/labels/team/control-plane","name":"team/control-plane","color":"d2b48c"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-10-27T01:06:08Z","updated_at":"2015-10-27T14:25:17Z","closed_at":null,"body":"I'd like to delete certain external resources (loadbalancers) only when the cluster is being torn down. Not when the user deletes the pod, or the scheduler preempts it. Currently scripts like kube-down aren't kubernetes aware, they just start nuking cluster resources using gcloud, meaning the following happens:\r\n\r\n```console\r\n$ ./cluster/kube-up.sh\r\n\r\n$ cat <<EOF | kubectl create -f -\r\n> apiVersion: v1\r\n> kind: Service\r\n> metadata:\r\n>   name: nginxsvc\r\n>   labels:\r\n>     app: nginx\r\n> spec:\r\n>   type: LoadBalancer\r\n>   ports:\r\n>   - port: 8080\r\n>     targetPort: 80\r\n>     protocol: TCP\r\n>     name: http\r\n>   - port: 443\r\n>     protocol: TCP\r\n>     name: https\r\n>   selector:\r\n>     app: nginx\r\n> EOF\r\n\r\n$ kubectl get svc\r\nNAME         CLUSTER_IP    EXTERNAL_IP      PORT(S)            SELECTOR    AGE\r\nkubernetes   10.0.0.1      <none>           443/TCP            <none>      2m\r\nnginxsvc     10.0.104.32   104.154.47.133   8080/TCP,443/TCP   app=nginx   1m\r\n\r\n$ gcloud compute forwarding-rules list \r\nNAME                        REGION      IP_ADDRESS      IP_PROTOCOL TARGET\r\na5653a6897c4311e5bf0242010af0000 us-central1 104.154.47.133  TCP         us-central1/targetPools/a5653a6897c4311e5bf0242010af0000\r\n\r\n$ ./cluster/kube-down.sh\r\nDone\r\n\r\n$ gcloud compute forwarding-rules list\r\nNAME                        REGION      IP_ADDRESS      IP_PROTOCOL TARGET\r\na5653a6897c4311e5bf0242010af0000 us-central1 104.154.47.133  TCP         us-central1/targetPools/a5653a6897c4311e5bf0242010af0000\r\n```\r\n\r\nHaving at least the following guarantees when there's a pending shutdown will make life a little easier:\r\n1. Deny new resource create requests\r\n2. Notify existing services/controllers/pods\r\n\r\n@thockin \r\n"},"comment":{"url":"https://api.github.com/repos/kubernetes/kubernetes/issues/comments/151514138","html_url":"https://github.com/kubernetes/kubernetes/issues/16337#issuecomment-151514138","issue_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/16337","id":151514138,"user":{"login":"bgrant0607","id":7725777,"avatar_url":"https://avatars.githubusercontent.com/u/7725777?v=3","gravatar_id":"","url":"https://api.github.com/users/bgrant0607","html_url":"https://github.com/bgrant0607","followers_url":"https://api.github.com/users/bgrant0607/followers","following_url":"https://api.github.com/users/bgrant0607/following{/other_user}","gists_url":"https://api.github.com/users/bgrant0607/gists{/gist_id}","starred_url":"https://api.github.com/users/bgrant0607/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bgrant0607/subscriptions","organizations_url":"https://api.github.com/users/bgrant0607/orgs","repos_url":"https://api.github.com/users/bgrant0607/repos","events_url":"https://api.github.com/users/bgrant0607/events{/privacy}","received_events_url":"https://api.github.com/users/bgrant0607/received_events","type":"User","site_admin":false},"created_at":"2015-10-27T14:25:17Z","updated_at":"2015-10-27T14:25:17Z","body":"See also #13515"}}