2

I am using jmdns to broadcast a service over mdns which is then running as a docker image inside a kubernetes pod. The pod yaml looks something like this:

apiVersion: v1
kind: Pod
metadata:
  name: mdns-broadcaster
spec:
  hostNetwork: true
  containers:
    - name: mdns-broadcasting-pod
      image: ...

The application will start up and broadcast some service type _example._tcp. However, running avahi-browse from the single node hosting this pod, I cannot see such a service being broadcast.

Any help would be appreciated, thanks

1 Answer 1

5

In case anybody cares, I resolved this by moving from mDNS for the kubernetes implementation to avahi. This allows you to then share the dbus directory on the host file system with the pod in order to perform mDNS announcements.

4
  • Thanks for sharing this! So all you had to do to get the avahi messages to show up on the network was mounting /var/run/dbus and/or /run/dbus into the container?
    – phhe
    Commented Nov 23, 2018 at 22:10
  • Yeah just mounting /var/run/dbus and using avahi internally worked, all messages showed up on the host machine's network
    – Ben C
    Commented Nov 25, 2018 at 15:38
  • 1
    Thanks you for what you've already written. This would be super useful for me; but I don't know enough about avahi to fully interpret your answer. It sounds like you: 1. Used a docker image that had (or you installed) avahi. 2. Used a hostpath volume to mount /var/run/dbus from the node into the container. 3. ??? How do you map k8s services to avahi then?
    – jwhitlark
    Commented Feb 28, 2019 at 18:11
  • Both the host and the docker image have avahi installed. The mounted dbus file allows for the avahi executables within the docker image to act as if they were the executables in the host machine
    – Ben C
    Commented Jun 12, 2019 at 15:10

Not the answer you're looking for? Browse other questions tagged or ask your own question.