kubernetes headless service FQDN for pods

1,045 views
Skip to first unread message

george...@gmail.com

unread,
May 19, 2017, 9:32:42 AM5/19/17
to Kubernetes user discussion and Q&A
Hello everybody,

I was following the kubernetes tutorial from here
https://kubernetes.io/docs/tutorials/stateful-application/zookeeper/. The tutorial is great and I was able to run it successfully.

However, I tried to reproduce the steps of running zookeeper using a separate namespace.
First, I tried to configure the zoo.cfg like this:

server.1=zk-0.zk-headless:2888:3888
server.2=zk-1.zk-headless:2888:3888
server.3=zk-2.zk-headless:2888:3888

This setup didn't work. Only two nodes server.2 and server.3 were forming a cluster, sometimes also server.1 and server.2 but it was always that one of the servers didn't join the cluster.

The configuration that worked for me for zoo.cfg was:

server.1=zk-0.zk-headless.mynamespace.svc.cluster.local:2888:3888
server.2=zk-1.zk-headless.mynamespace.svc.cluster.local:2888:3888
server.3=zk-2.zk-headless.mynamespace.svc.cluster.local:2888:3888

With this config all 3 zookeepers were forming a cluster and everything works fine.
The question is why do I need to specify the FQDN for this example to work? Even in the first case were I specified statefulset.service, this name was resolved to only one IP. Are FQDN always
necessary when referencing a pod in a stateful set like in the above example?


I'm running kubernetes 1.6 on AWS with one master and one worked node.

Thanks,
George

Brandon Philips

unread,
May 19, 2017, 12:27:56 PM5/19/17
to Kubernetes user discussion and Q&A
Hrm, the svc.namespace resolution _should_ work. Can you test the zk-2.zk-headless record? See the troubleshooting tips on this page for how: https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/

If you can't get those instructions to work we there are some more DNS / networking debugging docs here.

Aside: We just released a new project called zetcd which makes emulates zookeeper on top of an etcd cluster. This makes it possible to launch an etcd cluster on Kubernetes with the etcd Operator and run zookeeper on top. This is the first release of zetcd though, but mesos and kafka are working against it.

Cheers,

Brandon


--
You received this message because you are subscribed to the Google Groups "Kubernetes user discussion and Q&A" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kubernetes-use...@googlegroups.com.
To post to this group, send email to kubernet...@googlegroups.com.
Visit this group at https://groups.google.com/group/kubernetes-users.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages