<p>I am running <code>minikube v1.15.1</code> on <code>MacOS</code> and installed <code>helm v3.4.1</code>. I run <code>helm install elasticsearch elastic/elasticsearch --set resources.requests.memory=2Gi --set resources.limits.memory=4Gi --set replicas=1</code> to install elasticsearch on k8s cluster. The pod <code>elasticsearch-master-0</code> is deployed but it is in <code>pending</code> status.</p>
<p>When I run <code>kubectl describe pod elasticsearch-master-0</code> it gives me below warning:</p>
<pre><code>
Warning  FailedScheduling  61s (x2 over 2m30s)  default-scheduler  0/1 nodes are available: 1 Insufficient memory.

</code></pre>
<p>it ways <code>Insufficient memory</code> but my host has at least 4GB free memory. Does the memory issue means the <code>minikube</code> doesn't have enough memory? If yes, how can I increase its memory?</p>
<p>I have increased memory in minikube and restarted minikube but still has the same issue.</p>
<p>I did run <code>minikube delete</code> followed by <code>minikube start</code>. You can see below output that it using 4 CPUs and 8GB memory</p>
<pre><code> minikube v1.15.1 on Darwin 11.0.1
✨  Automatically selected the docker driver. Other choices: hyperkit, virtualbox
👍  Starting control plane node minikube in cluster minikube
🔥  Creating docker container (CPUs=4, Memory=8096MB) ...
🐳  Preparing Kubernetes v1.19.4 on Docker 19.03.13 ...
🔎  Verifying Kubernetes components...
🌟  Enabled addons: default-storageclass, storage-provisioner
🏄  Done! kubectl is now configured to use &quot;minikube&quot; cluster and &quot;default&quot; namespace by default
</code></pre>
<p>Below is the code to get cpu and memory from config.</p>
<pre><code>$ minikube config get cpus
4
$ minikube config get memory
8096
</code></pre>
<p>Below is the output from <code>metrics-server</code>.</p>
<pre><code>$ kubectl top node
NAME       CPU(cores)   CPU%   MEMORY(bytes)   MEMORY%
minikube   466m         5%     737Mi           37%

$ kubectl top pod
W1125 20:11:23.232025   46719 top_pod.go:265] Metrics not available for pod default/elasticsearch-master-0, age: 34m3.231199s
error: Metrics not available for pod default/elasticsearch-master-0, age: 34m3.231199s
</code></pre>
<p>The full output of <code>kubectl describe pod</code> is:</p>
<pre><code>$ kubectl describe pod elasticsearch-master-0
Name:           elasticsearch-master-0
Namespace:      default
Priority:       0
Node:           &lt;none&gt;
Labels:         app=elasticsearch-master
                chart=elasticsearch
                controller-revision-hash=elasticsearch-master-677c65788d
                release=elasticsearch
                statefulset.kubernetes.io/pod-name=elasticsearch-master-0
Annotations:    &lt;none&gt;
Status:         Pending
IP:
IPs:            &lt;none&gt;
Controlled By:  StatefulSet/elasticsearch-master
Init Containers:
  configure-sysctl:
    Image:      docker.elastic.co/elasticsearch/elasticsearch:7.10.0
    Port:       &lt;none&gt;
    Host Port:  &lt;none&gt;
    Command:
      sysctl
      -w
      vm.max_map_count=262144
    Environment:  &lt;none&gt;
    Mounts:
      /var/run/secrets/kubernetes.io/serviceaccount from default-token-kthrd (ro)
Containers:
  elasticsearch:
    Image:       docker.elastic.co/elasticsearch/elasticsearch:7.10.0
    Ports:       9200/TCP, 9300/TCP
    Host Ports:  0/TCP, 0/TCP
    Limits:
      cpu:     1
      memory:  4Gi
    Requests:
      cpu:      1
      memory:   2Gi
    Readiness:  exec [sh -c #!/usr/bin/env bash -e
# If the node is starting up wait for the cluster to be ready (request params: &quot;wait_for_status=green&amp;timeout=1s&quot; )
# Once it has started only check that the node itself is responding
START_FILE=/tmp/.es_start_file

# Disable nss cache to avoid filling dentry cache when calling curl
# This is required with Elasticsearch Docker using nss &lt; 3.52
export NSS_SDB_USE_CACHE=no

http () {
  local path=&quot;${1}&quot;
  local args=&quot;${2}&quot;
  set -- -XGET -s

  if [ &quot;$args&quot; != &quot;&quot; ]; then
    set -- &quot;$@&quot; $args
  fi

  if [ -n &quot;${ELASTIC_USERNAME}&quot; ] &amp;&amp; [ -n &quot;${ELASTIC_PASSWORD}&quot; ]; then
    set -- &quot;$@&quot; -u &quot;${ELASTIC_USERNAME}:${ELASTIC_PASSWORD}&quot;
  fi

  curl --output /dev/null -k &quot;$@&quot; &quot;http://127.0.0.1:9200${path}&quot;
}

if [ -f &quot;${START_FILE}&quot; ]; then
  echo 'Elasticsearch is already running, lets check the node is healthy'
  HTTP_CODE=$(http &quot;/&quot; &quot;-w %{http_code}&quot;)
  RC=$?
  if [[ ${RC} -ne 0 ]]; then
    echo &quot;curl --output /dev/null -k -XGET -s -w '%{http_code}' \${BASIC_AUTH} http://127.0.0.1:9200/ failed with RC ${RC}&quot;
    exit ${RC}
  fi
  # ready if HTTP code 200, 503 is tolerable if ES version is 6.x
  if [[ ${HTTP_CODE} == &quot;200&quot; ]]; then
    exit 0
  elif [[ ${HTTP_CODE} == &quot;503&quot; &amp;&amp; &quot;7&quot; == &quot;6&quot; ]]; then
    exit 0
  else
    echo &quot;curl --output /dev/null -k -XGET -s -w '%{http_code}' \${BASIC_AUTH} http://127.0.0.1:9200/ failed with HTTP code ${HTTP_CODE}&quot;
    exit 1
  fi

else
  echo 'Waiting for elasticsearch cluster to become ready (request params: &quot;wait_for_status=green&amp;timeout=1s&quot; )'
  if http &quot;/_cluster/health?wait_for_status=green&amp;timeout=1s&quot; &quot;--fail&quot; ; then
    touch ${START_FILE}
    exit 0
  else
    echo 'Cluster is not yet ready (request params: &quot;wait_for_status=green&amp;timeout=1s&quot; )'
    exit 1
  fi
fi
] delay=10s timeout=5s period=10s #success=3 #failure=3
    Environment:
      node.name:                     elasticsearch-master-0 (v1:metadata.name)
      cluster.initial_master_nodes:  elasticsearch-master-0,
      discovery.seed_hosts:          elasticsearch-master-headless
      cluster.name:                  elasticsearch
      network.host:                  0.0.0.0
      ES_JAVA_OPTS:                  -Xmx1g -Xms1g
      node.data:                     true
      node.ingest:                   true
      node.master:                   true
      node.remote_cluster_client:    true
    Mounts:
      /usr/share/elasticsearch/data from elasticsearch-master (rw)
      /var/run/secrets/kubernetes.io/serviceaccount from default-token-kthrd (ro)
Conditions:
  Type           Status
  PodScheduled   False
Volumes:
  elasticsearch-master:
    Type:       PersistentVolumeClaim (a reference to a PersistentVolumeClaim in the same namespace)
    ClaimName:  elasticsearch-master-elasticsearch-master-0
    ReadOnly:   false
  default-token-kthrd:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  default-token-kthrd
    Optional:    false
QoS Class:       Burstable
Node-Selectors:  &lt;none&gt;
Tolerations:     node.kubernetes.io/not-ready:NoExecute op=Exists for 300s
                 node.kubernetes.io/unreachable:NoExecute op=Exists for 300s
Events:
  Type     Reason            Age                From               Message
  ----     ------            ----               ----               -------
  Warning  FailedScheduling  76s (x2 over 77s)  default-scheduler  0/1 nodes are available: 1 Insufficient memory.
</code></pre>

Joey Yi Zhao
<p>Minikube on mac uses a virtual machine to host kubernetes. This is separate from the host and restricts the available memory for the single node cluster.</p>
<p>You can configure more memory for the VM using</p>
<pre><code>minikube start --memory=4096
</code></pre>
