<p>I have reactjs app running on my pod and I have mounted source code from the host machine to the pod. It works fine but when I change my code in the host machine, pod source code also changes but when I run the site it has not affected the application. here is my manifest, what I'm doing wrong?</p>

<pre><code>---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: webapp
spec:
  replicas: 1
  minReadySeconds: 15
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxUnavailable: 1
      maxSurge: 1
  template:
    metadata:
      labels:
        app: webapp
        tier: frontend
        phase: development
    spec:
      containers:
      - name: webapp
        image: xxxxxx            
        command:
        - npm
        args:
        - run
        - dev
        env:
        - name: environment
          value:  dev
        - name: AUTHOR
          value: webapp
        ports:
        - containerPort: 3000
        volumeMounts:
        - mountPath: /code
          name: code
      imagePullSecrets:
        - name: regcred
      volumes:
        - name: code
          hostPath:
            path: /hosthome/xxxx/development/react-app/src
</code></pre>

<p>and i know for a fact npm is not watching my changes, how can i resolve it in pods?</p>

<p>Basically, you need to reload your application everytime you change your code and your pods don't reload or restart when you change the code under the <code>/code</code> directory.  You will have to re-create your pod since you are using a deployment you can either:</p>

<pre><code>kubectl delete &lt;pod-where-your-app-is-running&gt;
</code></pre>

<p>or </p>

<pre><code>export PATCH='{"spec":{"template":{"metadata":{"annotations":{"timestamp":"'$(date)'"}}}}}'
kubectl patch deployment webapp -p "$PATCH"
</code></pre>

<p>Your pods should restart after that.</p>
