Sound on kubernetes

Hello -

I am trying to get a sound app working for kubernetes use, and for testing I am trying to get a test platform working on the dev machines using minikube. And the first thing I am trying is to get the pulse audio socket mounted and accessible to the app in the pod. I have the socket there, but the app keeps giving me a connection refused error. I can get the docker image working from a local container with docker run, but I can’t get it to work in minikube. I’m not sure what I am missing, if I could get some help or some general notes in the best way of exposing the machine sound to a pod in minikube.

Cluster information:

Kubernetes version: minikube version: v1.12.1
Cloud being used: bare-metal
Installation method: Not sure
Host OS: Ubuntu 18.04.5 LTS
CNI and version: not sure
CRI and version: not sure

You can format your yaml by highlighting it and pressing Ctrl-Shift-C, it will make your output easier to read.

apiVersion: v1
kind: ConfigMap
  creationTimestamp: 2020-08-06T18:01:01Z
  name: pulse-audio-config-data
  namespace: default
  config-file: |-
    default-server = unix:/tmp/pulse/pulseaudio.socket
    autospawn = no
    daemon-binary = /bin/true
    enable-shm = false
  apiVersion: apps/v1
  kind: Deployment
    name: my-service-deployment
      app: my-service
    replicas: 1
        app: my-service
          app: my-service
          fsGroup: 9999
          - name: audio-socket
              path: /tmp/pulse
          - name: pulse-conf
              name: pulse-audio-config-data
                - key: config-file
                  path: client.conf
          - name: my-service
            image: my-image:my-tag
              runAsUser: 9999
              runAsGroup: 9999
              allowPrivilegeEscalation: true
              privileged: true
              - name: PULSE_SERVER
                value: "unix:/tmp/pulse/pulseaudio.socket"
              - name: PULSE_COOKIE
                value: "/tmp/pulseaudio.cookie"
              - name: audio-socket
                mountPath: "/tmp/pulse"
              - name: pulse-conf
                mountPath: /etc/pulse

When you exec into your pod’s container, do the config file and audio socket file look right and are they at the correct locations? Also, are there any helpful excerpts when you check your pod’s logs?

Yes, the config is in the right spot: ‘/etc/pulse/client.conf’, and it looks correct. And the pulseaudio.socket is in /tmp/pulse. The logs are only telling me that Pulse audio: connection refused.

Ok I guess I would probably try to turn on verbose logging. I am not familiar with pulseaudio (I was going to help with your volume mounts if you noticed something was awry), and so i would be no more useful to you than the posts you have already likely googled about this

Verbose logging in minikube? Oh, are there different logging levels for the pod and container I can use? “my_service” already has pretty verbose logging going…

I was thinking you could turn on verbose logging for your app to see more information leading up to the Connection refused. I would probably try to exec in and inspect your unix socket and try to connect to it via this sort of thing. I don’t have good advice on the way a container running in a Pod handles sound, but I would try to approach troubleshooting it in a general way to get a better understanding of why your client can’t connect to the server unix socket