Skip to content

High idle CPU usage when enabling Kubernetes #3065

Closed

Description

@siberex
  • I have tried with the latest version of my channel (Edge)
  • I have uploaded Diagnostics
  • Diagnostics ID: CFEA972F-586B-4BD1-AE0C-BF698AA89BB6/20180709-130229

Expected behavior

Low idle CPU usage after enabling Kubernetes.

Actual behavior

High idle CPU usage after enabling Kubernetes (no matter with Kubernetes or Swarm selected as orchestrator).

Information

  • macOS Version: 10.13.5 (17F77), High Sierra

Diagnostic logs

Docker for Mac: version: 18.05.0-ce-mac67 (1fa4e2acfc1a52f79623add2390604515d32297e)
macOS: version 10.13.5 (build: 17F77)
logs: /tmp/CFEA972F-586B-4BD1-AE0C-BF698AA89BB6/20180709-130229.tar.gz
[OK]     vpnkit
[OK]     virtualization hypervisor
[OK]     vmnetd
[OK]     dns
[OK]     driver.amd64-linux
[OK]     virtualization VT-X
[OK]     app
[OK]     moby
[OK]     system
[OK]     moby-syslog
[OK]     kubernetes
[OK]     files
[OK]     env
[OK]     virtualization kern.hv_support
[OK]     osxfs
[OK]     moby-console
[OK]     logs
[OK]     docker-cli
[OK]     disk

Steps to reproduce the behavior

  1. Install latest edge branch Docker for Mac.
  2. Enable Kubernetes in Preferences (no matter with Kubernetes or Swarm selected as orchestrator).

Without adding any pods with kubectl and without creating any containers with docker, process com.docker.hyperkit starts eating a lot of CPU.

Disabling Kubernetes in Preferences solves the problem (com.docker.hyperkit returns to the normal idle behaviour with 1-2% CPU consuming).

Activity

  1. hori-ryota commented on Jul 10, 2018

    @hori-ryota
  2. jodawill commented on Jul 16, 2018

    @jodawill

    Same issue here. It makes my computer run hot and kills my battery.

  3. mehmetsalgar commented on Jul 19, 2018

    @mehmetsalgar

    Same here, when I got it first I read some tips about increase the memory for Docker, reduce the number of assigned CPUs and remove unnecessary files sharing and using :cache in VOLUME statement in Dockerfile.

    It helped for a while but today whike I like to test auto scale and one of the Deployment on Kubernetes did not started while 1 CPU was available, when I am gone 2 CPU again %100 load and going back to 1 CPU is not helping anymore.

  4. miro-kube commented on Jul 30, 2018

    @miro-kube

    yes, it's an issue for me too, 30 to 40% cpu usage when idle
    Version 18.06.0-ce-mac70, channel stable,

  5. zwing99 commented on Aug 4, 2018

    @zwing99

    Yes please fix this!!!!

  6. atombender commented on Aug 13, 2018

    @atombender

    Dupe of #2601.

  7. mlh758 commented on Oct 12, 2018

    @mlh758

    I'm using Version 2.0.0.0-beta1-mac75 (27117) and I'm sitting at 391% CPU on my mac within seconds of turning on Kubernetes.

  8. pfriedland commented on Dec 16, 2018

    @pfriedland

    yep. if I reduce the number of cores under Docker->Preferences->Advanced to something like '1', then the overall com.docker.hyperkit CPU utilization goes down proportionally. If I disable Kubernetes local cluster, the CPU utilization pretty much disappears from the Mac Activity Monitor. I think people have to buffer expectations when using k8s on a Mac with Docker. It should be for experimentation and minimal developer activities. Otherwise, use k8s in a real, provisioned environment to save your Mac from burning through CPU and the associated heat it generates.

  9. mlh758 commented on Dec 16, 2018

    @mlh758

    I don’t see anywhere near this kind of utilization using minikube though. This is specific to Docker Kuberbetes.

  10. greenkiwi commented on Dec 17, 2018

    @greenkiwi

    I see this pretty consistently:
    Version 2.0.0.0-mac81 (29211)
    Channel: stable
    4271b9e6a8
    Engine: 18.09.0
    Machine: 0.16.0
    Kubernetes: v1.10.3

  11. tvarwig commented on Jan 7, 2019

    @tvarwig

    same issue. Specific to Docker kubernetes. Minikube does not do this.
    Version 2.0.0.0-mac81 (29211)
    Channel: stable
    4271b9e6a8
    Engine: 18.09.0
    Kubernetes: v1.10.3

  12. blaircraige commented on Jan 25, 2019

    @blaircraige

    I've been experiencing the same issue. Diagnostic ID 898161E2-ACF9-44BC-A5B3-834CE43DC787/20190125224340.

  13. 14 remaining items

  14. HarryWeppner commented on Oct 8, 2019

    @HarryWeppner

    /remove-lifecycle stale

    I still think this is very much an issue that will hinder K8s adoption - how could I help?

  15. sovereignstack commented on Oct 15, 2019

    @sovereignstack

    I think this is a Kubernetes issue. I am using Rancher on 3 node cluster with a separate master. All machines are 2 vCPU, 8 GB RAM, SSD. There is just one nginx deployment and nothing is accessing it.
    Before enabling metrics, it had reserved 15% CPU
    After Enabling Metrics its even more.
    image

  16. tekumara commented on Dec 17, 2019

    @tekumara

    I'm running

    MBP 2019 16GB RAM
    macOS Version: 10.14.6 (18G1012)
    Docker for Mac: version... 2.1.0.5 (40693) stable
    Kubernetes: v1.14.8

    and I've given Docker Desktop for Mac:

    CPUs: 6
    Memory: 2 GiB
    Swap: 1 GiB

    Using screen to jump into the LinuxKit VM I can see etcd eating up the CPU

    docker-desktop:~# top -n 1
    Mem: 1607508K used, 439048K free, 712K shrd, 168380K buff, 652040K cached
    CPU:   0% usr   0% sys   0% nic 100% idle   0% io   0% irq   0% sirq
    Load average: 0.29 0.37 0.53 1/954 86877
      PID  PPID USER     STAT   VSZ %VSZ CPU %CPU COMMAND
    29225 29221 root     S     229m  11%   4   0% kubelet --kubeconfig=/etc/kubernet
    53038 52988 root     S     211m  11%   0   0% kube-controller-manager --authenti
    30495 30432 root     S    10.0g 514%   4   0% etcd --advertise-client-urls=https
     1540  1469 root     S    1928m  96%   1   0% containerd --config /var/run/docke
     1469  1450 root     S    1054m  53%   5   0% /usr/local/bin/dockerd -H unix:///
    30496 30465 root     S     464m  23%   5   0% kube-apiserver --advertise-address
    31447 31411 root     S     143m   7%   5   0% /api-server --kubeconfig  --authen
     1074     1 root     S     141m   7%   4   0% /usr/bin/containerd
    34852 34835 65534    S     141m   7%   5   0% /tiller
    31904 31868 root     S     139m   7%   3   0% /coredns -conf /etc/coredns/Corefi
    31897 31861 root     S     139m   7%   2   0% /coredns -conf /etc/coredns/Corefi
    52977 52941 root     S     139m   7%   5   0% kube-scheduler --bind-address=127.
    31454 31428 root     S     136m   7%   2   0% /usr/local/bin/kube-proxy --config
    31854 31836 root     S     129m   6%   4   0% /compose-controller --kubeconfig
     1297  1285 root     S     115m   6%   0   0% /usr/bin/lifecycle-server
     1153  1136 root     S     114m   6%   3   0% /usr/local/bin/diagnosticsd -port
     1176  1074 root     S     107m   5%   5   0% containerd-shim -namespace service
     1385  1074 root     S     107m   5%   1   0% containerd-shim -namespace service
     1097  1074 root     S     107m   5%   0   0% containerd-shim -namespace service
     1476  1074 root     S     107m   5%   2   0% containerd-shim -namespace service
    

    I've created etcd-io/etcd#11460

  17. kevinresol commented on Mar 12, 2020

    @kevinresol

    Same here, after "Enable Kubernetes" and "Apply & Restart" I see a 35-45% idle CPU usage. With Kubernetes disabled it is about 4-5%.

    docker desktop (mac): 2.2.0.3 (42716)
    kubernetes: v1.15.5

    Diagnostic ID:
    w/ k8s: 33A2468B-90E9-426A-BB3B-9BA3EC73A242/20200312171855
    w/o k8s: 33A2468B-90E9-426A-BB3B-9BA3EC73A242/20200312170959

  18. planetf1 commented on Mar 13, 2020

    @planetf1

    I noticed that running minikube/microk8s/k3s are generally significantly more cpu friendly for k8s.

  19. noygal commented on Mar 15, 2020

    @noygal

    Same here, after "Enable Kubernetes" and "Apply & Restart" I see a 35-45% idle CPU usage. With Kubernetes disabled it is about 4-5%.

    docker desktop (mac): 2.2.0.3 (42716)
    kubernetes: v1.15.5

    Diagnostic ID:
    w/ k8s: 33A2468B-90E9-426A-BB3B-9BA3EC73A242/20200312171855
    w/o k8s: 33A2468B-90E9-426A-BB3B-9BA3EC73A242/20200312170959

    Same here

  20. IgorVitol commented on Apr 14, 2020

    @IgorVitol

    Hey! I made CPU usage test using different drivers for minikube (hyperkit / virtualbox) and compared it with Docker Desktop for Mac (Kubernetes enabled).

    Conditions:

    1. CPU's: 2 (more CPU - more usage in idle, that's general behavior in all tests, 2 is fine for normal debugging)
    2. Memory: 5 GB
    3. Few different containers (LAMP stack) are up and running for about 10 mins (idle)

    Results:

    1. Docker Desktop with Kubernetes Enabled - https://prnt.sc/rz9p6i
    2. Minikube with Hyperkit driver - https://prnt.sc/rz9q3y
    3. Minikube with VirtualBox driver - https://prnt.sc/rz9qqa

    As you can see - first two options are almost the same ~ 100% CPU . I guess that's because both ENVs used HyperKit.

    But for "Minikube with VirtualBox driver" results were much better - CPU usage reduced almost twice. It usually jumps from 30 to 60.

    Here is sample minikube configuration for Case 3 :

    # Configure VM resources
    minikube config set cpus 2
    minikube config set memory 5120
     
    # Set default driver. VirtualBox should be installed first.
    minikube config set driver virtualbox
    
    # Start minikube. If other driver was already used - first run "minikube delete"
    minikube start
    
  21. stephen-turner commented on Jul 7, 2020

    @stephen-turner
    Contributor

    I'm going to close this ticket. We are in the middle of a big investigation about Mac CPU usage (see docker/roadmap#12). However, this specific ticket is an upstream issue in Kubernetes, kubernetes/kubernetes#75565, which we cannot fix in Docker Desktop. Other single-node Kubernetes distributions (minikube, kind, etc.) suffer from the same problem. It needs to be fixed upstream. Sorry that we can't do anything about it here.

    Of course, this doesn't affect the other CPU tickets we have open that are within Docker's domain. We are aware of them, accept responsibility for them, and are actively looking at them.

  22. locked and limited conversation to collaborators on Jul 7, 2020
  23. docker-robott commented on Aug 6, 2020

    @docker-robott
    Collaborator

    Closed issues are locked after 30 days of inactivity.
    This helps our team focus on active issues.

    If you have found a problem that seems similar to this, please open a new issue.

    Send feedback to Docker Community Slack channels #docker-for-mac or #docker-for-windows.
    /lifecycle locked

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions