{"action":"created","issue":{"url":"https://api.github.com/repos/kubernetes/kube-state-metrics/issues/584","repository_url":"https://api.github.com/repos/kubernetes/kube-state-metrics","labels_url":"https://api.github.com/repos/kubernetes/kube-state-metrics/issues/584/labels{/name}","comments_url":"https://api.github.com/repos/kubernetes/kube-state-metrics/issues/584/comments","events_url":"https://api.github.com/repos/kubernetes/kube-state-metrics/issues/584/events","html_url":"https://github.com/kubernetes/kube-state-metrics/issues/584","id":380855208,"node_id":"MDU6SXNzdWUzODA4NTUyMDg=","number":584,"title":"Not running pod still listed as running","user":{"login":"r0bj","id":1297747,"node_id":"MDQ6VXNlcjEyOTc3NDc=","avatar_url":"https://avatars0.githubusercontent.com/u/1297747?v=4","gravatar_id":"","url":"https://api.github.com/users/r0bj","html_url":"https://github.com/r0bj","followers_url":"https://api.github.com/users/r0bj/followers","following_url":"https://api.github.com/users/r0bj/following{/other_user}","gists_url":"https://api.github.com/users/r0bj/gists{/gist_id}","starred_url":"https://api.github.com/users/r0bj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/r0bj/subscriptions","organizations_url":"https://api.github.com/users/r0bj/orgs","repos_url":"https://api.github.com/users/r0bj/repos","events_url":"https://api.github.com/users/r0bj/events{/privacy}","received_events_url":"https://api.github.com/users/r0bj/received_events","type":"User","site_admin":false},"labels":[{"id":764090593,"node_id":"MDU6TGFiZWw3NjQwOTA1OTM=","url":"https://api.github.com/repos/kubernetes/kube-state-metrics/labels/kind/bug","name":"kind/bug","color":"e11d21","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2018-11-14T19:38:50Z","updated_at":"2018-11-22T16:18:13Z","closed_at":null,"author_association":"NONE","body":"<!-- This form is for bug reports and feature requests ONLY! \r\n\r\nIf you're looking for help check [KUBE-STATE-METRICS](https://github.com/kubernetes/kube-state-metrics) and the [troubleshooting guide](https://kubernetes.io/docs/tasks/debug-application-cluster/troubleshooting/).\r\n-->\r\n\r\n**Is this a BUG REPORT or FEATURE REQUEST?**:\r\n\r\n> Uncomment only one, leave it on its own line: \r\n>\r\n/kind bug\r\n> /kind feature\r\n\r\n\r\n**What happened**:\r\n\r\nFinished pod (eg. `mw-cj-delete-articles-by-prefix-1542086820-7khfh`):\r\n```\r\nkubectl -n prod get pod mw-cj-delete-articles-by-prefix-1542086820-7khfh\r\nNAME                                               READY     STATUS    RESTARTS   AGE\r\nmw-cj-delete-articles-by-prefix-1542086820-7khfh   0/1       Error     0          1d\r\n```\r\n\r\nBut pod is still listed as running in metrics, eg:\r\n- kube_pod_container_status_running\r\n```\r\nkube_pod_container_status_running{pod=\"mw-cj-delete-articles-by-prefix-1542086820-7khfh\"}\r\n\r\nkube_pod_container_status_running{container=\"php\",endpoint=\"https-main\",instance=\"10.200.225.223:8443\",job=\"kube-state-metrics\",namespace=\"prod\",pod=\"mw-cj-delete-articles-by-prefix-1542086820-7khfh\",service=\"kube-state-metrics\"}\r\n```\r\n- kube_pod_container_resource_requests\r\n```\r\nkube_pod_container_resource_requests{pod=\"mw-cj-delete-articles-by-prefix-1542086820-7khfh\"}\r\n\r\nkube_pod_container_resource_requests{container=\"php\",endpoint=\"https-main\",instance=\"10.200.225.223:8443\",job=\"kube-state-metrics\",namespace=\"prod\",node=\"k8s-worker-s31\",pod=\"mw-cj-delete-articles-by-prefix-1542086820-7khfh\",resource=\"cpu\",service=\"kube-state-metrics\",unit=\"core\"}\r\nkube_pod_container_resource_requests{container=\"php\",endpoint=\"https-main\",instance=\"10.200.225.223:8443\",job=\"kube-state-metrics\",namespace=\"prod\",node=\"k8s-worker-s31\",pod=\"mw-cj-delete-articles-by-prefix-1542086820-7khfh\",resource=\"memory\",service=\"kube-state-metrics\",unit=\"byte\"}\r\n```\r\n\r\nIn this case correct calculation resources of running containers is impossible.\r\n\r\n**What you expected to happen**:\r\n\r\nOnly running container are listed in metrics like `kube_pod_container_status_running`.\r\n\r\n**Anything else we need to know?**:\r\n\r\n**Environment**:\r\n- Kubernetes version (use `kubectl version`):\r\n```\r\nClient Version: version.Info{Major:\"1\", Minor:\"11\", GitVersion:\"v1.11.3\", GitCommit:\"a4529464e4629c21224b3d52edfe0ea91b072862\", GitTreeState:\"clean\", BuildDate:\"2018-09-09T18:02:47Z\", GoVersion:\"go1.10.3\", Compiler:\"gc\", Platform:\"linux/amd64\"}\r\nServer Version: version.Info{Major:\"1\", Minor:\"11\", GitVersion:\"v1.11.3\", GitCommit:\"a4529464e4629c21224b3d52edfe0ea91b072862\", GitTreeState:\"clean\", BuildDate:\"2018-09-09T17:53:03Z\", GoVersion:\"go1.10.3\", Compiler:\"gc\", Platform:\"linux/amd64\"}\r\n```\r\n- Kube-state-metrics image version: v1.4.0"},"comment":{"url":"https://api.github.com/repos/kubernetes/kube-state-metrics/issues/comments/441075949","html_url":"https://github.com/kubernetes/kube-state-metrics/issues/584#issuecomment-441075949","issue_url":"https://api.github.com/repos/kubernetes/kube-state-metrics/issues/584","id":441075949,"node_id":"MDEyOklzc3VlQ29tbWVudDQ0MTA3NTk0OQ==","user":{"login":"r0bj","id":1297747,"node_id":"MDQ6VXNlcjEyOTc3NDc=","avatar_url":"https://avatars0.githubusercontent.com/u/1297747?v=4","gravatar_id":"","url":"https://api.github.com/users/r0bj","html_url":"https://github.com/r0bj","followers_url":"https://api.github.com/users/r0bj/followers","following_url":"https://api.github.com/users/r0bj/following{/other_user}","gists_url":"https://api.github.com/users/r0bj/gists{/gist_id}","starred_url":"https://api.github.com/users/r0bj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/r0bj/subscriptions","organizations_url":"https://api.github.com/users/r0bj/orgs","repos_url":"https://api.github.com/users/r0bj/repos","events_url":"https://api.github.com/users/r0bj/events{/privacy}","received_events_url":"https://api.github.com/users/r0bj/received_events","type":"User","site_admin":false},"created_at":"2018-11-22T16:18:13Z","updated_at":"2018-11-22T16:18:13Z","author_association":"NONE","body":"Thanks @brancz. In this case I just need to combine resource metric (eg. `kube_pod_container_resource_requests`) with status metric (eg. `kube_pod_container_status_running` or `kube_pod_status_phase`)."}}
{"actor":{"display_login":"r0bj"}}