{"action":"created","issue":{"url":"https://api.github.com/repos/kubernetes/kubernetes/issues/62605","repository_url":"https://api.github.com/repos/kubernetes/kubernetes","labels_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/62605/labels{/name}","comments_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/62605/comments","events_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/62605/events","html_url":"https://github.com/kubernetes/kubernetes/issues/62605","id":314465727,"node_id":"MDU6SXNzdWUzMTQ0NjU3Mjc=","number":62605,"title":"statefulSet: check external dns entry is created before running command","user":{"login":"hochuenw","id":17544876,"node_id":"MDQ6VXNlcjE3NTQ0ODc2","avatar_url":"https://avatars1.githubusercontent.com/u/17544876?v=4","gravatar_id":"","url":"https://api.github.com/users/hochuenw","html_url":"https://github.com/hochuenw","followers_url":"https://api.github.com/users/hochuenw/followers","following_url":"https://api.github.com/users/hochuenw/following{/other_user}","gists_url":"https://api.github.com/users/hochuenw/gists{/gist_id}","starred_url":"https://api.github.com/users/hochuenw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hochuenw/subscriptions","organizations_url":"https://api.github.com/users/hochuenw/orgs","repos_url":"https://api.github.com/users/hochuenw/repos","events_url":"https://api.github.com/users/hochuenw/events{/privacy}","received_events_url":"https://api.github.com/users/hochuenw/received_events","type":"User","site_admin":false},"labels":[{"id":267761362,"node_id":"MDU6TGFiZWwyNjc3NjEzNjI=","url":"https://api.github.com/repos/kubernetes/kubernetes/labels/kind/feature","name":"kind/feature","color":"c7def8","default":false},{"id":116712108,"node_id":"MDU6TGFiZWwxMTY3MTIxMDg=","url":"https://api.github.com/repos/kubernetes/kubernetes/labels/sig/network","name":"sig/network","color":"d2b48c","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-04-16T00:11:33Z","updated_at":"2018-07-15T00:44:11Z","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 [Stack Overflow](https://stackoverflow.com/questions/tagged/kubernetes) 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\r\n/kind feature\r\n\r\n\r\n**What happened**:\r\n\r\ngiven this yaml:\r\n\r\n```\r\n apiVersion: v1\r\n kind: Service\r\n metadata:\r\n   name: nginx\r\n   labels:\r\n     app: nginx\r\n spec:\r\n   ports:\r\n   - port: 80\r\n     name: web\r\n   clusterIP: None\r\n   selector:\r\n     app: nginx\r\n---\r\napiVersion: apps/v1\r\nkind: StatefulSet\r\nmetadata:\r\n  name: web\r\nspec:\r\n  selector:\r\n    matchLabels:\r\n      app: nginx # has to match .spec.template.metadata.labels\r\n  podManagementPolicy: Parallel \r\n  serviceName: \"nginx\"\r\n  replicas: 2 # by default is 1\r\n  template:\r\n    metadata:\r\n      labels:\r\n        app: nginx # has to match .spec.selector.matchLabels\r\n    spec:\r\n      restartPolicy: Always\r\n      containers:\r\n      - name: nginx\r\n        image: busybox\r\n        command: [\"sh\", \"-c\", \"ping web-0.nginx; sleep 3; ping web-0.nginx\"]\r\n        ports:\r\n        - containerPort: 80```\r\n```\r\n\r\nlog is:\r\n```\r\nping: bad address 'web-0.nginx'\r\nPING web-0.nginx (10.244.0.78): 56 data bytes\r\n64 bytes from 10.244.0.78: seq=0 ttl=64 time=0.031 ms\r\n64 bytes from 10.244.0.78: seq=1 ttl=64 time=0.041 ms\r\n64 bytes from 10.244.0.78: seq=2 ttl=64 time=0.038 ms\r\n64 bytes from 10.244.0.78: seq=3 ttl=64 time=0.071 ms\r\n64 bytes from 10.244.0.78: seq=4 ttl=64 time=0.045 ms\r\n64 bytes from 10.244.0.78: seq=5 ttl=64 time=0.059 ms\r\n```\r\nThe first ping failed. but after 3 seconds, it works. My guess is that pod is addressable through the headless service, and the external dns entry just need some time to be created..\r\nSo in order to ping the other with success, I have to add `sleep 3` before all commands.\r\nCan a statefulSet have some logic like `until nslookup 'web-0.nginx'; do echo waiting for myservice; sleep 2; done;` ?\r\n\r\n**What you expected to happen**:\r\nstatefulSet have some logic like `until nslookup 'web-0.nginx'; do echo waiting for myservice; sleep 2; done;`\r\n\r\n**How to reproduce it (as minimally and precisely as possible)**:\r\n\r\n**Anything else we need to know?**:\r\n\r\n**Environment**:\r\n- Kubernetes version (use `kubectl version`):\r\n- Cloud provider or hardware configuration:\r\n- OS (e.g. from /etc/os-release):\r\n- Kernel (e.g. `uname -a`):\r\n- Install tools:\r\n- Others:\r\n"},"comment":{"url":"https://api.github.com/repos/kubernetes/kubernetes/issues/comments/405059312","html_url":"https://github.com/kubernetes/kubernetes/issues/62605#issuecomment-405059312","issue_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/62605","id":405059312,"node_id":"MDEyOklzc3VlQ29tbWVudDQwNTA1OTMxMg==","user":{"login":"fejta-bot","id":30488982,"node_id":"MDQ6VXNlcjMwNDg4OTgy","avatar_url":"https://avatars1.githubusercontent.com/u/30488982?v=4","gravatar_id":"","url":"https://api.github.com/users/fejta-bot","html_url":"https://github.com/fejta-bot","followers_url":"https://api.github.com/users/fejta-bot/followers","following_url":"https://api.github.com/users/fejta-bot/following{/other_user}","gists_url":"https://api.github.com/users/fejta-bot/gists{/gist_id}","starred_url":"https://api.github.com/users/fejta-bot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fejta-bot/subscriptions","organizations_url":"https://api.github.com/users/fejta-bot/orgs","repos_url":"https://api.github.com/users/fejta-bot/repos","events_url":"https://api.github.com/users/fejta-bot/events{/privacy}","received_events_url":"https://api.github.com/users/fejta-bot/received_events","type":"User","site_admin":false},"created_at":"2018-07-15T00:44:11Z","updated_at":"2018-07-15T00:44:11Z","author_association":"NONE","body":"Issues go stale after 90d of inactivity.\nMark the issue as fresh with `/remove-lifecycle stale`.\nStale issues rot after an additional 30d of inactivity and eventually close.\n\nIf this issue is safe to close now please do so with `/close`.\n\nSend feedback to sig-testing, kubernetes/test-infra and/or [fejta](https://github.com/fejta).\n/lifecycle stale"}}
{"actor":{"display_login":"fejta-bot"}}