<p>I have the following deployment yaml:</p>

<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: iam-mysql
  labels:
    app: iam
    tier: mysql
  namespace: default
spec:
  replicas: 1
  selector:
    matchLabels:
      app: iam
      tier: mysql
  strategy:
    type: Recreate
  template:
    metadata:
      labels:
        app: iam
        tier: mysql
    spec:
      containers:
      - image: mysql:5.6
        name: iam-mysql
        envFrom:
        - configMapRef:
            name: iam-mysql-conf-dev
        - secretRef:
            name: iam-mysql-pass-dev
        ports:
        - containerPort: 3306
          name: iam-mysql
        volumeMounts:
          - name: iam-mysql-persistent-storage
            mountPath: /var/lib/mysql
          - name: mysql-initdb
            mountPath: /docker-entrypoint-initdb.d
      restartPolicy: Always
      volumes:
        - name: iam-mysql-persistent-storage
          persistentVolumeClaim:
            claimName: iam-mysql-pv-claim
        - name: mysql-initdb
          configMap:
            name: iam-mysql-initdb-dev
</code></pre>

<p>I cannot reload "iam-mysql-initdb-dev" with the new schema once it was create. In fact, I deleted a table (user) inside of the pod and when I created the deployment again the table (user) wasn't there. That means kubernetes is not reload the schema once the deployment has benn recreated.</p>

Agustin Castro
<p>That's expected behavior. Init files under <code>/docker-entrypoint-initdb.d/</code> directory, are ran only when the data directory is empty. That means only 1st time. </p>

<p>If you look into the entry-point script of MySQL 5.6, you can see this process. 
In <a href="https://github.com/docker-library/mysql/blob/c0454b9e0ede6050deb66e2aabbc213b11b3eefe/5.6/docker-entrypoint.sh#L98" rel="nofollow noreferrer">line 98</a>, it checks if the data directory is empty.</p>

<ul>
<li>If it is empty, The script will run the init files of <code>/docker-entrypoint-initdb.d/</code> directory. See in <a href="https://github.com/docker-library/mysql/blob/c0454b9e0ede6050deb66e2aabbc213b11b3eefe/5.6/docker-entrypoint.sh#L190-L192" rel="nofollow noreferrer">line 190-192</a></li>
<li>If it is not empty, the whole entry point script will be ignored, From <a href="https://github.com/docker-library/mysql/blob/c0454b9e0ede6050deb66e2aabbc213b11b3eefe/5.6/docker-entrypoint.sh#L98-L207" rel="nofollow noreferrer">line 98 - 202 </a></li>
</ul>

<p>In kubernetes, when you are using a persistent volume, the volumes persists regarding deletion and recreation of pods. So, when pod restarts, the data directory is not empty. So, MySQL is skipping the init part, From <a href="https://github.com/docker-library/mysql/blob/c0454b9e0ede6050deb66e2aabbc213b11b3eefe/5.6/docker-entrypoint.sh#L98-L207" rel="nofollow noreferrer">line 98 - 202 </a></p>
