<p>Defining the <strong>defaultMode</strong> in a Kubernetes <strong>volume</strong> field within a <strong>deployment</strong> element can become quite tricky.</p>
<p>It expects three decimals, corresponding to the binary UNIX permissions.</p>
<p>As an example, to mount the ConfigMap with permissions r------, you'd need to specify 256.</p>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: foo
  namespace: foo
spec:
  replicas: 1
  selector:
    matchLabels:
      app: foo
  template:
    metadata:
      labels:
        app: foo
    spec:
      containers:
        - image: php-fpm:latest
          volumeMounts:
            - name: phpini
              mountPath: /usr/local/etc/php/conf.d/99-settings.ini
              readOnly: true
              subPath: 99-settings.ini
      volumes:
        - configMap:
            defaultMode: 256
            name: phpini-configmap
            optional: false
          name: phpini
---
apiVersion: v1
kind: ConfigMap
metadata:
  labels:
    app: foo
  namespace: foo
  name: phpini-configmap
data:
  99-settings.ini: |
    ; Enable Zend OPcache extension module
    zend_extension = opcache
</code></pre>

Jesus Iniesta
<p>Use the following table:</p>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th>unix decimal</th>
<th>unix readable</th>
<th>binary equivalent</th>
<th>defaultMode</th>
</tr>
</thead>
<tbody>
<tr>
<td>400</td>
<td>r--------</td>
<td>100000000</td>
<td>256</td>
</tr>
<tr>
<td>440</td>
<td>r--r-----</td>
<td>100100000</td>
<td>288</td>
</tr>
<tr>
<td>444</td>
<td>r--r--r--</td>
<td>100100100</td>
<td>292</td>
</tr>
<tr>
<td>600</td>
<td>rw-------</td>
<td>110000000</td>
<td>384</td>
</tr>
<tr>
<td>600</td>
<td>rw-r-----</td>
<td>110100000</td>
<td>416</td>
</tr>
<tr>
<td>660</td>
<td>rw-rw----</td>
<td>110110000</td>
<td>432</td>
</tr>
<tr>
<td>660</td>
<td>rw-rw-r--</td>
<td>110110100</td>
<td>436</td>
</tr>
<tr>
<td>666</td>
<td>rw-rw-rw-</td>
<td>110110110</td>
<td>438</td>
</tr>
<tr>
<td>700</td>
<td>rwx------</td>
<td>111000000</td>
<td>448</td>
</tr>
<tr>
<td>770</td>
<td>rwxrwx---</td>
<td>111111000</td>
<td>504</td>
</tr>
<tr>
<td>777</td>
<td>rwxrwxrwx</td>
<td>111111111</td>
<td>511</td>
</tr>
</tbody>
</table>
</div>
<p>A more direct way to do this is to use a base8 to base10 converter like <a href="http://www.unitconversion.org/numbers/base-8-to-base-10-conversion.html" rel="noreferrer">this one</a></p>
