music-assistant

by wittdennis

Helm chartv1.0.4App 2.10.13MITVerified publisher

Helm chart for Music Assistant server

About this chart

music-assistant

Helm chart for Music Assistant server

Maintainers

NameEmailUrl
Dennis Witthttps://github.com/wittdennis

Source Code

AirPlay

The server runs as an unprivileged user with all capabilities dropped. AirPlay playback works, but AirPlay 2 multi-room sync does not: it relies on a PTP clock daemon that binds the privileged UDP ports 319 and 320. The server logs a warning on startup and falls back to NTP timing, so grouped AirPlay 2 speakers may drift apart.

An added capability is not effective for a non-root user, because Kubernetes grants no ambient capabilities. The unprivileged port range cannot be lowered per pod either, because net.ipv4.ip_unprivileged_port_start belongs to the node's network namespace on the host network.

Lowering the unprivileged port range on the node

This keeps the server unprivileged. Set the sysctl on every node the server can be scheduled on, and persist it across reboots:

sysctl -w net.ipv4.ip_unprivileged_port_start=319
echo 'net.ipv4.ip_unprivileged_port_start = 319' > /etc/sysctl.d/90-music-assistant.conf

The sysctl is scoped to a network namespace, so it applies only to processes on the node's host network. Pods with their own network keep the default of 1024. It covers IPv6 as well. UDP 319 and 320 have to be free on the node, so nothing else, such as ptp4l, may already listen on them.

Running as root

If the node cannot be changed, run the server as root and add the NET_BIND_SERVICE capability:

podSecurityContext:
  runAsNonRoot: false
  runAsUser: 0
  runAsGroup: 0
securityContext:
  runAsNonRoot: false
  capabilities:
    add:
      - NET_BIND_SERVICE

Helm merges these into the defaults, so runAsNonRoot has to be set to false explicitly in both contexts, otherwise the kubelet refuses to start a root container. Everything else stays in place: all other capabilities remain dropped, privilege escalation stays disabled and the root filesystem stays read-only. UDP 319 and 320 have to be free on the node here as well.

Values

KeyTypeDefaultDescription
affinityobject{}
enableServiceLinksbooltrueIndicates whether information about services should be injected into pod's environment variables, matching the syntax of Docker links
extraArgslist[]Additional command line arguments appended to the server container args
extraEnvlist[]Additional environment variables for the server container, e.g. [{"name": "TZ", "value": "Europe/Berlin"}]
fullnameOverridestring""
imageobject{"pullPolicy":"IfNotPresent","registry":"ghcr.io","repository":"music-assistant/server","tag":""}This sets the container image more information can be found here: https://kubernetes.io/docs/concepts/containers/images/
image.pullPolicystring"IfNotPresent"This sets the pull policy for images.
image.registrystring"ghcr.io"Container registry where the repository is hosted
image.repositorystring"music-assistant/server"Container repository
image.tagstring""Overrides the image tag whose default is the chart appVersion.
imagePullSecretslist[]This is for the secretes for pulling an image from a private repository more information can be found here: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/
ingressobject{"annotations":{},"className":"","enabled":false,"hosts":[{"host":"chart-example.local","paths":[{"path":"/","pathType":"ImplementationSpecific"}]}],"tls":[]}This block is for setting up the ingress for more information can be found here: https://kubernetes.io/docs/concepts/services-networking/ingress/
livenessProbeobject{"httpGet":{"path":"/info","port":"http"}}This is to setup the liveness and readiness probes more information can be found here: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/
log.logLevelstring"info"Global logging level, possible options are: critical, error, warning, info, debug, verbose
nameOverridestring""This is to override the chart name.
nodeSelectorobject{}Selector to control on which node the pods should be running
persistenceobject{"size":"5Gi","storageClassName":null}Settings for storage
persistence.sizestring"5Gi"Size for the persistent volume claim. Holds the database, settings and the artwork cache
persistence.storageClassNamestringnilStorage class to use for persistent storage. If left empty default storage class will be used.
podAnnotationsobject{}This is for setting Kubernetes Annotations to a Pod. For more information checkout: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/
podLabelsobject{}This is for setting Kubernetes Labels to a Pod. For more information checkout: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/
podSecurityContextobject{"fsGroup":1000,"fsGroupChangePolicy":"OnRootMismatch","runAsGroup":1000,"runAsNonRoot":true,"runAsUser":1000,"seccompProfile":{"type":"RuntimeDefault"}}Security context of the pod. More information can be found here: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/
portint8095Port of the web server and API. Binds on the node directly because the pod uses the host network. The server reads the port from its own settings, so this has to match Settings > System > Web Server
readinessProbe.httpGet.pathstring"/info"
readinessProbe.httpGet.portstring"http"
resourcesobject{}
routeobject{"additionalRules":[],"annotations":{},"enabled":false,"filters":[],"hostnames":[],"labels":{},"matches":[{"path":{"type":"PathPrefix","value":"/"}}],"parentRefs":[]}This block is for setting up gateway api http route. More information can be found here: https://gateway-api.sigs.k8s.io/
route.additionalRuleslist[]Any custom rule you want to specify
route.annotationsobject{}Additional annotations for the HTTPRoute
route.enabledboolfalseFlag to control if route should be created
route.filterslist[]Filter that should be added to the default rule
route.hostnameslist[]Hostnames of the HTTPRoute
route.labelsobject{}Additional labels for the HTTPRoute
route.matcheslist[{"path":{"type":"PathPrefix","value":"/"}}]Matches for the default rule
route.parentRefslist[]Gateway reference that the HTTPRoute should bind against
safeModeboolfalseStart in safe mode, which only loads the core controllers and no providers. Useful to recover from a misbehaving provider
securityContextobject{"allowPrivilegeEscalation":false,"capabilities":{"drop":["ALL"]},"privileged":false,"readOnlyRootFilesystem":true,"runAsNonRoot":true}Security context of the server container. AirPlay 2 multi-room PTP sync binds the privileged UDP ports 319/320 and otherwise falls back to NTP timing. See the AirPlay section of the README for the options
serviceobject{"port":80,"type":"ClusterIP"}This is for setting up a service more information can be found here: https://kubernetes.io/docs/concepts/services-networking/service/
service.portint80This sets the ports more information can be found here: https://kubernetes.io/docs/concepts/services-networking/service/#field-spec-ports
service.typestring"ClusterIP"This sets the service type more information can be found here: https://kubernetes.io/docs/concepts/services-networking/service/#publishing-services-service-types
serviceAccountobject{"annotations":{},"automount":false,"create":true,"name":""}This section builds out the service account more information can be found here: https://kubernetes.io/docs/concepts/security/service-accounts/
serviceAccount.annotationsobject{}Annotations to add to the service account
serviceAccount.automountboolfalseAutomatically mount a ServiceAccount's API credentials?
serviceAccount.createbooltrueSpecifies whether a service account should be created
serviceAccount.namestring""The name of the service account to use. If not set and create is true, a name is generated using the fullname template
startupProbeobject{"failureThreshold":30,"httpGet":{"path":"/info","port":"http"},"periodSeconds":10}Used to define a startup probe. More information can be found here: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/#define-startup-probes
tolerationslist[]
volumeMountslist[]Additional volumeMounts on the output StatefulSet definition.
volumeslist[]Additional volumes on the output StatefulSet definition, e.g. a local music library

Deploy music-assistant with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has music-assistant on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartmusic-assistant is pinned at v1.0.4 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below
opentenant validate opentenant.yaml
terraform init && terraform apply