Why kubernetes minikube limits global CPU usage?

11/5/2020

I have minikube k8s instalation on my home PC(ubuntu20.04, amd 3950x, 128gb RAM).

  capacity:
    cpu: '32'
    ephemeral-storage: 1967435760Ki
    hugepages-1Gi: '0'
    hugepages-2Mi: '0'
    memory: 131897524Ki
    pods: '110'
  allocatable:
    cpu: '32'
    ephemeral-storage: 1967435760Ki
    hugepages-1Gi: '0'
    hugepages-2Mi: '0'
    memory: 131897524Ki
    pods: '110'

A have created 2 deployments with 3 replicas. Each pod can utilize 1 core CPU. This is one of deployments:

spec:
  replicas: 3
  selector:
    matchLabels:
      app: another-server
  template:
    metadata:
      creationTimestamp: null
      labels:
        app: another-server
    spec:
      containers:
        - name: server
          image: 'server:v6'
          resources:
            limits:
              cpu: '2'
            requests:
              cpu: '2'
          terminationMessagePath: /dev/termination-log
          terminationMessagePolicy: File
          imagePullPolicy: IfNotPresent
      restartPolicy: Always
      terminationGracePeriodSeconds: 30
      dnsPolicy: ClusterFirst
      securityContext: {}
      schedulerName: default-scheduler

Total CPU usage by all pods is ALWAYS limited to 2 CPU. It looks like there is some kind of global setting to limit CPU usage.

pc:~$ kubectl top pod
NAME                             CPU(cores)   MEMORY(bytes)   
another-server-5477557cd-7fmqh   301m         15Mi            
another-server-5477557cd-ddcht   304m         16Mi            
another-server-5477557cd-lp9vk   276m         15Mi            
worker-6889bcc6f5-45zjt          332m         3Mi             
worker-6889bcc6f5-b977s          326m         3Mi             
worker-6889bcc6f5-s2rsc          326m         3Mi

Is it possible start several pods with 1 CPU limit for each pod?

-- user1941407
cpu-usage
docker
kubernetes
minikube
ubuntu

1 Answer

11/5/2020

Minikube is started as docker container with default cpu limit 2. You should recreate minikube with new limit:

minikube stop
minikube delete 
minikube start --cpus 16
-- user1941407
Source: StackOverflow