title: K8s init container restart itself
body: <p>I have pod that includes one init container and one app container,
  between them there is a volume with shared folder.</p>
  <p>My issue is that once a day or even more, the init container run itself and therefore it delete the node modules from the volume, then the main app crash because of missing modules.
  The app container is not making any restarts, only the init container.</p>
  <p>is anyone familiar with this issue in k8s? why those restarts happens only in the init container?</p>
  <p>Thanks :)</p>
  <p>edit:
  the deployment yaml file -</p>
  <pre><code>apiVersion: extensions/v1beta1
  kind: Deployment
  metadata:
    annotations:
      deployment.kubernetes.io/revision: &quot;25&quot;
    creationTimestamp: &quot;2020-05-19T06:48:18Z&quot;
    generation: 25
    labels:
      apps: ******
      commit: ******
    name: *******
    namespace: fleet
    resourceVersion: &quot;24059934&quot;
    selfLink: *******
    uid: *******
  spec:
    progressDeadlineSeconds: 600
    replicas: 1
    revisionHistoryLimit: 10
    selector:
      matchLabels:
        app: *******
    strategy:
      rollingUpdate:
        maxSurge: 1
        maxUnavailable: 25%
      type: RollingUpdate
    template:
      metadata:
        creationTimestamp: null
        labels:
          app: *******
          commit: *******
          revision: *******
      spec:
        containers:
          image: XXXXXXXXXXXX
          imagePullPolicy: IfNotPresent
          livenessProbe:
            failureThreshold: 3
            httpGet:
              path: /ping
              port: http
              scheme: HTTP
            initialDelaySeconds: 120
            periodSeconds: 30
            successThreshold: 1
            timeoutSeconds: 30
          name: *******
          ports:
          - containerPort: 1880
            name: http
            protocol: TCP
          readinessProbe:
            failureThreshold: 20
            httpGet:
              path: /ping
              port: http
              scheme: HTTP
            initialDelaySeconds: 20
            periodSeconds: 5
            successThreshold: 1
            timeoutSeconds: 30
          resources: {}
          terminationMessagePath: /dev/termination-log
          terminationMessagePolicy: File
          volumeMounts:
          - mountPath: /opt/breeze
            name: workdir
        dnsPolicy: ClusterFirst
        imagePullSecrets:
        - name: flowregistrykey
        initContainers:
          image: XXXXXXXXXXXX
          imagePullPolicy: IfNotPresent
          name: get-flow-json
          resources: {}
          terminationMessagePath: /dev/termination-log
          terminationMessagePolicy: File
          volumeMounts:
          - mountPath: /work-dir
            name: workdir
        restartPolicy: Always
        schedulerName: default-scheduler
        securityContext: {}
        terminationGracePeriodSeconds: 30
        volumes:
        - emptyDir: {}
          name: workdir
  status:
    availableReplicas: 1
    conditions:
    - lastTransitionTime: &quot;2020-06-01T12:30:10Z&quot;
      lastUpdateTime: &quot;2020-06-01T12:30:10Z&quot;
      message: Deployment has minimum availability.
      reason: MinimumReplicasAvailable
      status: &quot;True&quot;
      type: Available
    - lastTransitionTime: &quot;2020-05-19T06:48:18Z&quot;
      lastUpdateTime: &quot;2020-06-01T12:45:05Z&quot;
      message: ReplicaSet &quot;collection-associator.sandbox.services.collection-8784dcb9d&quot;
        has successfully progressed.
      reason: NewReplicaSetAvailable
      status: &quot;True&quot;
      type: Progressing
    observedGeneration: 25
    readyReplicas: 1
    replicas: 1
    updatedReplicas: 1
  </code></pre>
  <p>and this image explain the problem-
  the pod was created 7 days ago, but the files inside were created today, and there is no node_modules folder - because only the init container run again and not the app container so there was no mpm install</p>