pending pod on minikube kubernetes : insufficient cpu

5/14/2020

Running an application with three services on my local minikube while was installed on a server with 16 cpus and 64 GB of memory , one replicas of which is 2, I only set resources.limits for each service, as shown below

resources:
  limits:
    cpu: "2"
    memory: "209715200"

All service resource restrictions are the same.

However, some service pending appears.

The pending Pod describe partial output is as follows

Limits:
  cpu:     2
  memory:  209715200
Requests:
  cpu:     2
  memory:  209715200
...

Events:
  Type     Reason            Age        From               Message
  ----     ------            ----       ----               -------
  Warning  FailedScheduling  <unknown>  default-scheduler  0/1 nodes are available: 1 Insufficient cpu.
  Warning  FailedScheduling  <unknown>  default-scheduler  0/1 nodes are available: 1 Insufficient cpu.

The result of kubectl get pod is as follows

kubectl get pod
NAME                        READY   STATUS    RESTARTS   AGE
test1-777f54bcdb-pvfn5      1/1     Running   0          4m49s
test2-75ccb875b-lj9xl       1/1     Running   0          4m48s
test2-75ccb875b-s7xht       1/1     Running   0          4m48s
test3-797f6b795f-z9qv5      0/1     Pending   0          4m48s

The result of kubectl top node is as follows

kubectl top node
NAME CPU(cores)   CPU%   MEMORY(bytes)   MEMORY%   
test   1057m        13%    31675Mi         50% 

minikube version

# minikube version
minikube version: v1.9.2
commit: 93af9c1e43cab9618e301bc9fa720c63d5efa393

kubectl version

Client Version: version.Info{Major:"1", Minor:"16", GitVersion:"v1.16.0", GitCommit:"2bd9643cee5b3b3a5ecbd3af49d09018f0773c77", GitTreeState:"clean", BuildDate:"2019-09-18T14:36:53Z", GoVersion:"go1.12.9", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"16", GitVersion:"v1.16.0", GitCommit:"2bd9643cee5b3b3a5ecbd3af49d09018f0773c77", GitTreeState:"clean", BuildDate:"2019-09-18T14:27:17Z", GoVersion:"go1.12.9", Compiler:"gc", Platform:"linux/amd64"}

I'm confused that my server configuration should be able to run this application, but it pend due to insufficient CPU

Any comments would be greatly appreciated, thank you in advance!

-- moluzhui
kubernetes
minikube

2 Answers

5/14/2020

If you run minikube in a VM it is restricted by the amount of VM CPUs not the host ones. You can use minikube start --cpus N to start with N vCPUs

-- Radek 'Goblin' Pieczonka
Source: StackOverflow

5/14/2020

Running minikube with stock configs isn't going to make use of all your hardware potential. Minikube allows you to create nodes as big as you need and this is very important because the majority of people are using minikube on their workstation besides other applications and they don't want minikube to have unrestricted access to use your hardware.

To start minikube with custom specs you can do as Radek described, where you specify the amount of cpus and memory while starting your minikube.

$ minikube start --cpus N --memory N

Another option is to set these parameters as default:

$ minikube config set cpus N
$ minikube config set memory N 

To check all configurable parameters you can run minikube config.

Another reason to have your nodes with limited resources is that you can have a minikube cluster with multiple nodes and also multiple clusters on one machine. To create a minikube cluster with multiple nodes you can run:

# minikube start -n X

Where X is the number of desired nodes.

If you have a running minikube cluster and want to add another node to it, you can run:

$ minikube node add

To create a secondary minikube cluster you can run:

$ minikube start -p cluster-name

Where cluster-name is a name of your choice.

-- mWatney
Source: StackOverflow