<p>I have Skaffold working well with local development server and database deployments. I'm trying to get working on the <code>create-react-app</code> front-end, but the behavior is incredibly slow and erratic.</p>

<p><strong>Issues</strong></p>

<p>The main problems are the following:</p>

<ol>
<li>It takes upwards of five minutes from running <code>skaffold dev --port-forward --tail</code> for it finally start spinning up. Running just a <code>docker build</code> takes less than 30 seconds.</li>
<li>When it finally starts spinning up, it just sits on <code>Starting the development server...</code> for another two minutes.</li>
<li><p>Then, nine times out of ten, I get the following errors after several minutes (there are three because that is how many replicas there are):
<a href="https://i.stack.imgur.com/pmyC2.png" rel="noreferrer"><img src="https://i.stack.imgur.com/pmyC2.png" alt="enter image description here"></a></p>

<p>One out of ten times, it will actually go into the <code>Compiled Successfully! You can now view in the browser.</code> It never does launch in Chrome though.</p></li>
<li>Changes to JS in create-react-app are never reflected in new browser. You have to stop and run Skaffold again. Skaffold does say <code>Syncing 1 files for &lt;image&gt;... Watching for changes...</code>, but nothing changes even after a refresh.</li>
</ol>

<p><strong>What I've tried</strong></p>

<ol>
<li>I've really simplified what I'm trying to do to make it easier to sort this out, so I'm using just an OOTB <code>create-react-app</code> application. The behavior is the same regardless.</li>
<li><code>minikube delete</code> and <code>minikube start</code> several times (did this because even the server deployment started acting erratically after trying <code>create-react-app</code>)</li>
</ol>

<p><strong>Code and Steps to Reproduce</strong></p>

<p>I'm on macOS Mojave (10.14.6) using Docker for Mac, Kubernetes (v1.16.0), minikube (v1.4.0), Skaffold (v0.39.0), and <code>create-react-app</code>. I'll have to skip the installation process for all of these since it is fairly lengthy, so the following steps assume you have this already setup.</p>

<ol>
<li><p>Make a project directory:</p>

<p><code>mkdir project</code></p></li>
<li><p>Make a Kubernetes manifest directory and move into it:</p>

<p><code>mkdir k8s &amp;&amp; cd k8s</code></p></li>
<li><p>Make a <code>client-deployment.yaml</code> and add the following:</p>

<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: client-deployment
spec:
  replicas: 3
  selector:
    matchLabels:
      component: web
  template:
    metadata:
      labels:
        component: web
    spec:
      containers:
        - name: client
          image: testapp/client
          ports:
            - containerPort: 3000
</code></pre></li>
<li><p>Make a <code>client-cluster-ip-service.yaml</code> and add the following:</p>

<pre><code>apiVersion: v1
kind: Service
metadata:
  name: client-cluster-ip-service
spec:
  type: ClusterIP
  selector:
    component: web
  ports:
    - port: 3000
      targetPort: 3000
</code></pre></li>
<li><p>Move back into the parent:</p>

<p><code>cd ..</code></p></li>
<li><p>Create a <code>skaffold.yaml</code> and add the following:</p>

<pre><code>apiVersion: skaffold/v1beta15
kind: Config
build:
  local:
    push: false
  artifacts:
    - image: testapp/client
      context: web
      docker:
        dockerfile: Dockerfile.dev
      sync:
        manual:
          - src: "**/*.js"
            dest: .
          - src: "**/*.html"
            dest: .
          - src: "**/*.css"
            dest: .
deploy:
  kubectl:
    manifests:
      - k8s/client-deployment.yaml
      - k8s/client-cluster-ip-service.yaml
portForward:
  - resourceType: service
    resourceName: client-cluster-ip-service
    port: 3000
    localPort: 3000
</code></pre></li>
<li><p>Start a new <code>create-react-app</code> project:</p>

<p><code>npx create-react-app test-app</code></p></li>
<li><p>Change into the directory:</p>

<p><code>cd test-app</code></p></li>
<li><p>Create a <code>Dockerfile.dev</code> and add the following:</p>

<pre><code>FROM node:alpine

WORKDIR '/app'
EXPOSE 3000
CMD ["npm", "run", "start"]

COPY package* ./
RUN npm install
COPY . .
</code></pre></li>
<li><p>Create a <code>.dockerignore</code> file and add the following:</p>

<pre><code>node_modules
*.swp
</code></pre></li>
<li><p>Go back into the parent directory:</p>

<p><code>cd ..</code></p></li>
<li><p>Make sure <code>minikube</code> is running:</p>

<p><code>minikube start</code></p></li>
<li><p>Run the <code>skaffold.yaml</code>:</p>

<p><code>skaffold dev --port-forward --tail</code></p></li>
</ol>

<p>This is what produces the issues for me.</p>

cjones
<p>Ok. Disregard. Started with one replica and it worked fine. Two worked fine. Three worked if <code>skaffold</code> was already running, but not from a fresh <code>skaffold dev --port-forward --tail</code>. </p>

<p><code>skaffold ssh</code> and then did a <code>top</code>. Was running out of RAM... well was at 86% utilization. Increased it from the default 2GB to 8GB and now it works fine.</p>

<p>First deleted the VM with <code>minikube delete</code> and then created a new one with <code>minikube start --memory='8g'</code>. All good now.</p>
