-
Notifications
You must be signed in to change notification settings - Fork 39k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pod's dns subdomain cannot be resolved if headless service name not same as StatefulSet name #74950
Comments
/sig network |
I just tried this using the yaml here - https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/#creating-a-statefulset Verified the the service 'nginx` is indeed headless, returns the pod ips when resolving the service name - nginx. I was able to resolve: Can you share the yaml you were using? |
/assign @dunjut |
@prameshj: GitHub didn't allow me to assign the following users: dastan. Note that only kubernetes members and repo collaborators can be assigned and that issues/PRs can only have 10 assignees at the same time. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
@prameshj Could you try to remove the Now I think this may be by design but I don't understand why |
I can't remove the serviceName : 'missing required field "serviceName" in io.k8s.api.apps.v1.StatefulSetSpec' if you don't specify serviceName, I don't see how the endpoints for the headless service can be updated to include the pods in the statefulSet. Can you share the yamls for how you created the service and statefulSets? It looks like this is working as intended. |
@prameshj Sorry I just noticed your reply. This should be easy to reproduce, you can change The headless service with a selector already includes the pods in StatefulSet, I just don't understand why |
I understood the issue now, maybe it should read "Pod's dns subdomain cannot be resolved if headless service name not same as serviceName in StatefulSet spec"? This is working as intended. From the api doc: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.10/#statefulset-v1-apps "selector is a label query over pods that should match the replica count. It must match the pod template's labels." "serviceName is the name of the service that governs this StatefulSet. This service must exist before the StatefulSet, and is responsible for the network identity of the set. Pods get DNS/hostnames that follow the pattern: pod-specific-string.serviceName.default.svc.cluster.local where "pod-specific-string" is managed by the StatefulSet controller. serviceName is used for dns records, selector is for determining count of replicas. Closing issue since this is working as intended. Please reopen if needed. |
@prameshj: Closing this issue. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
If anyone is wondering why this is said to be working as intended when the api reference does not mention anything about headless service, the docs talk about this under Limitations.
|
What happened:
case A:
In namespace foo, create a StatefulSet named database and a headless service named database, I can successfully resolve database-0.database.foo.svc.cluster.local.
case B:
In namespace foo, create a StatefulSet named database and a headless service named db-svc, I failed to resolve database-0.db-svc.foo.svc.cluster.local.
What you expected to happen:
In case B, Pod's subdomain should be successfully resolved.
How to reproduce it (as minimally and precisely as possible):
Just create a StatefulSet and a headless service...
Anything else we need to know?:
Environment:
kubectl version
):cat /etc/os-release
): Ubuntu 16.04.2 LTSuname -a
): Linux master 4.4.0-62-generic add travis integration #83-Ubuntu SMP Wed Jan 18 14:10:15 UTC 2017 x86_64 x86_64 x86_64 GNU/LinuxThe text was updated successfully, but these errors were encountered: