<p>Using Kubernetes 1.7.0, the intention here is to be able to deploy MySQL / MongoDB / etc, and use local disk as storage backing; while webheads, and processing pods can autoscale by Kubernetes. To these aims, I've</p>

<ul>
<li>Set up &amp; deployed the <a href="https://github.com/kubernetes-incubator/external-storage/tree/master/local-volume" rel="nofollow noreferrer">Local Persistent Storage provisioner</a> to automatically provision locally attached disk to pods' Persitent Volume Claims. </li>
<li>Manually created a Persistent Volume Claim, which succeeds, and the local volume is attached</li>
<li><p>Attempted to deploy MariaDB via helm by</p>

<blockquote>
  <p>helm install --name mysql --set persistence.storageClass=default stable/mariadb</p>
</blockquote></li>
<li><p>This appears to succeed; but by going to the dashboard, I get</p></li>
</ul>

<blockquote>
  <p>Storage node affinity check failed for volume "local-pv-8ef6e2af" : NodeSelectorTerm [{Key:kubernetes.io/hostname Operator:In Values:[kubemaster]}] does not match node labels</p>
</blockquote>

<p>I suspect this might be due to helm's charts not including nodeaffinity. Other than updating each chart manually,  is there a way to tell helm to deploy to the same pod where the provisioner has the volume?</p>

<p>Unfortunately, no. You will need to specify node affinity so that the Pod lands on the node where the local storage is located. See the <a href="https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#node-affinity-beta-feature" rel="nofollow noreferrer">docs on Node Affinity</a> to know what do add to the helm chart.</p>

<p>I suspect it would look something like the following in your case.</p>

<pre><code>affinity:
  nodeAffinity:
    requiredDuringSchedulingIgnoredDuringExecution:
      nodeSelectorTerms:
      - matchExpressions:
        - key: kubernetes.io/hostname
          operator: In
          values:
          - kubemaster
</code></pre>

<p>As an aside, this is something that will happen, not just at the node level, but at the zone level for cloud environments like AWS and GCP as well. In those environments, persistent disks are zonal and will require you to set <code>NodeAffinity</code> so that the Pods land in the zone with the persistent disk when deploying to a multi-zone cluster.</p>

<p>Also as an aside, It looks like your are deploying to the Kubernetes master? If so that may not be advisable since MySQL could potentially affect the master's operation.</p>
