{"action":"created","issue":{"url":"https://api.github.com/repos/kubernetes/kubernetes/issues/54247","repository_url":"https://api.github.com/repos/kubernetes/kubernetes","labels_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/54247/labels{/name}","comments_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/54247/comments","events_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/54247/events","html_url":"https://github.com/kubernetes/kubernetes/issues/54247","id":266926691,"node_id":"MDU6SXNzdWUyNjY5MjY2OTE=","number":54247,"title":"kubelet: lifecycle hooks can't write to termination message file","user":{"login":"stevekuznetsov","id":7328370,"node_id":"MDQ6VXNlcjczMjgzNzA=","avatar_url":"https://avatars1.githubusercontent.com/u/7328370?v=4","gravatar_id":"","url":"https://api.github.com/users/stevekuznetsov","html_url":"https://github.com/stevekuznetsov","followers_url":"https://api.github.com/users/stevekuznetsov/followers","following_url":"https://api.github.com/users/stevekuznetsov/following{/other_user}","gists_url":"https://api.github.com/users/stevekuznetsov/gists{/gist_id}","starred_url":"https://api.github.com/users/stevekuznetsov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stevekuznetsov/subscriptions","organizations_url":"https://api.github.com/users/stevekuznetsov/orgs","repos_url":"https://api.github.com/users/stevekuznetsov/repos","events_url":"https://api.github.com/users/stevekuznetsov/events{/privacy}","received_events_url":"https://api.github.com/users/stevekuznetsov/received_events","type":"User","site_admin":false},"labels":[{"id":105146071,"node_id":"MDU6TGFiZWwxMDUxNDYwNzE=","url":"https://api.github.com/repos/kubernetes/kubernetes/labels/kind/bug","name":"kind/bug","color":"e11d21","default":false},{"id":173493665,"node_id":"MDU6TGFiZWwxNzM0OTM2NjU=","url":"https://api.github.com/repos/kubernetes/kubernetes/labels/sig/node","name":"sig/node","color":"d2b48c","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":11,"created_at":"2017-10-19T17:34:39Z","updated_at":"2018-07-18T22:09:53Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"**What happened**:\r\nI wrote a `preStop` hook and wanted to see the output of it, even if it succeeded. I therefore set the `pod.spec.containers.terminationMessagePath` to a file and wrote to that file in the hook.\r\n\r\n**What you expected to happen**:\r\nI expected what I wrote to the file to be exposed in the pod status message once it terminated.\r\n\r\n**How to reproduce it (as minimally and precisely as possible)**:\r\n\r\nCreate this pod:\r\n```yaml\r\napiVersion: v1\r\nkind: Pod\r\nmetadata:\r\n  name: test\r\nspec:\r\n  containers:\r\n  - command:\r\n    - /bin/sh\r\n    args:\r\n    - -c\r\n    - 'echo command > /tmp/log'\r\n    image: busybox\r\n    name: test\r\n    terminationMessagePath: /tmp/log\r\n    terminationMessagePolicy: File\r\n    lifecycle:\r\n      preStop:\r\n        exec:\r\n          command:\r\n          - '/bin/sh'\r\n          - '-c'\r\n          - 'echo hook > /tmp/log'\r\n  restartPolicy: Never\r\n```\r\n\r\nRun this:\r\n```sh\r\n$ kubectl create -f /tmp/pod.yaml\r\npod \"test\" created\r\n$ kubectl get pod test -o jsonpath='{.status.containerStatuses[?(@.name==\"test\")].state.terminated.message}'\r\ncommand\r\n```\r\n\r\n**Environment**:\r\n- Kubernetes version (use `kubectl version`):\r\n```\r\n$ kubectl version\r\nClient Version: version.Info{Major:\"1\", Minor:\"7\", GitVersion:\"v1.7.0+695f48a16f\", GitCommit:\"d2e5420\", GitTreeState:\"clean\", BuildDate:\"2017-08-31T19:30:25Z\", GoVersion:\"go1.8.3\", Compiler:\"gc\", Platform:\"linux/amd64\"}\r\nServer Version: version.Info{Major:\"1\", Minor:\"7\", GitVersion:\"v1.7.0+695f48a16f\", GitCommit:\"d2e5420\", GitTreeState:\"clean\", BuildDate:\"2017-08-30T13:35:56Z\", GoVersion:\"go1.8.3\", Compiler:\"gc\", Platform:\"linux/amd64\"}\r\n```\r\n\r\n/kind bug\r\n/cc @smarterclayton \r\n/sig node"},"comment":{"url":"https://api.github.com/repos/kubernetes/kubernetes/issues/comments/406090131","html_url":"https://github.com/kubernetes/kubernetes/issues/54247#issuecomment-406090131","issue_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/54247","id":406090131,"node_id":"MDEyOklzc3VlQ29tbWVudDQwNjA5MDEzMQ==","user":{"login":"stevekuznetsov","id":7328370,"node_id":"MDQ6VXNlcjczMjgzNzA=","avatar_url":"https://avatars1.githubusercontent.com/u/7328370?v=4","gravatar_id":"","url":"https://api.github.com/users/stevekuznetsov","html_url":"https://github.com/stevekuznetsov","followers_url":"https://api.github.com/users/stevekuznetsov/followers","following_url":"https://api.github.com/users/stevekuznetsov/following{/other_user}","gists_url":"https://api.github.com/users/stevekuznetsov/gists{/gist_id}","starred_url":"https://api.github.com/users/stevekuznetsov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stevekuznetsov/subscriptions","organizations_url":"https://api.github.com/users/stevekuznetsov/orgs","repos_url":"https://api.github.com/users/stevekuznetsov/repos","events_url":"https://api.github.com/users/stevekuznetsov/events{/privacy}","received_events_url":"https://api.github.com/users/stevekuznetsov/received_events","type":"User","site_admin":false},"created_at":"2018-07-18T22:09:53Z","updated_at":"2018-07-18T22:09:53Z","author_association":"CONTRIBUTOR","body":"/shrug"}}
{"actor":{"display_login":"stevekuznetsov"}}