With a Service called "myservice" backed onto a Statefulset called "mypods" you can curl
mypods-0.myservice
to direct traffic to the first pod in the Statefulset.
How can I accomplish something similar with a Daemonset?
With a Service called "myservice" backed onto a Statefulset called "mypods" you can curl
mypods-0.myservice
to direct traffic to the first pod in the Statefulset.
How can I accomplish something similar with a Daemonset?
According to kubernetes documentation, In general a pod has the following DNS resolution:
pod-ip-address.my-namespace.pod.cluster-domain.example
Any pods created by a Deployment or DaemonSet exposed by a Service have the following DNS resolution available:
pod-ip-address.deployment-name.my-namespace.svc.cluster-domain.example
pod-ip-address.daemonset-name.my-namespace.svc.cluster-domain.example
But instead of using pod-ip-address you can set hostname for pod in its yaml description. The Pod spec has an optional
hostname
field, which can be used to specify the Pod's hostname. So setpod.pec.hostname
Then following DNS resolution will available:pod-hostname.my-namespace.svc.cluster-domain.example