Kubernetes - meaning of CPU and core?












1














I don't really understand this after read through the document. Some use term like "CPU" but some use "core".



I am running Kubernetes in my laptop for testing purpose, my laptop has one CPU (2.2 Ghz) and 4 cores.



My question is, if I want to set the CPU request/limit for pod, the maximum resource that I have should be 1000m or 4000m?



Can anyone explain the difference (CPU vs Core) here in Kubernetes context?










share|improve this question



























    1














    I don't really understand this after read through the document. Some use term like "CPU" but some use "core".



    I am running Kubernetes in my laptop for testing purpose, my laptop has one CPU (2.2 Ghz) and 4 cores.



    My question is, if I want to set the CPU request/limit for pod, the maximum resource that I have should be 1000m or 4000m?



    Can anyone explain the difference (CPU vs Core) here in Kubernetes context?










    share|improve this question

























      1












      1








      1







      I don't really understand this after read through the document. Some use term like "CPU" but some use "core".



      I am running Kubernetes in my laptop for testing purpose, my laptop has one CPU (2.2 Ghz) and 4 cores.



      My question is, if I want to set the CPU request/limit for pod, the maximum resource that I have should be 1000m or 4000m?



      Can anyone explain the difference (CPU vs Core) here in Kubernetes context?










      share|improve this question













      I don't really understand this after read through the document. Some use term like "CPU" but some use "core".



      I am running Kubernetes in my laptop for testing purpose, my laptop has one CPU (2.2 Ghz) and 4 cores.



      My question is, if I want to set the CPU request/limit for pod, the maximum resource that I have should be 1000m or 4000m?



      Can anyone explain the difference (CPU vs Core) here in Kubernetes context?







      kubernetes






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 12 at 4:25









      GMsoF

      3,19495393




      3,19495393
























          4 Answers
          4






          active

          oldest

          votes


















          2














          To remove any guess work regarding your laptop or any other environment, execute



          kubectl get nodes


          ...and then this for a particular node:



          kubectl describe node <node-name>


          Look for cpu under Allocatable (which may have the same value as under Capacity).



          Take into consideration that



          1 CPU = 1000 millicores/millicpu


          when setting "fractional" resources.requests.cpu and resources.limits.cpu for containers.






          share|improve this answer





























            3














            To clarify what's described here in the Kubernetes context, 1 CPU is the same as a core.



            1000m (milicores) = 1 core = 1 CPU = 1 AWS vCPU = 1 GCP Core.
            100m (milicores) = 0.1 core = 0.1 CPU = 0.1 AWS vCPU = 0.1 GCP Core.


            For example, an Intel Core i7-6700 has 4 cores but it has Hyperthreading which doubles what the system sees in terms of cores. So in essence, it will show up in Kubernetes as:



            8000m = 8 cores = 8 CPUs


            Some extra info, these resources are managed by the kube-scheduler using the Completely Fair Scheduler (CFS) and the are no guarantees in terms of overruns within the same machine and your pod may be moved around.



            If you'd like to have stronger guarantees you might consider the --cpu-manager-policy=static (CPU Manager) option in the kubelet. More information here and here.






            share|improve this answer























            • Sorry, I don't understand how it can be 1 core = 1 cpu? For my laptop environment, what is the maximum resource I can allocate?
              – GMsoF
              Nov 12 at 5:45










            • whats the processor in your laptop?
              – Rico
              Nov 12 at 6:18










            • it is normal intel cpu i7-6700, 4 cores.
              – GMsoF
              Nov 12 at 6:25










            • so it's an i7 that means it has hyperthreading, which makes it look like that it has 8 cores. So there will be 8 cores/CPUs available to Kubernetes. Added more details to the answer
              – Rico
              Nov 12 at 14:59





















            0














            As mentioned here, https://kubernetes.io/docs/tasks/configure-pod-container/assign-cpu-resource/



            It clearly says that,



            The CPU resource is measured in CPU units. One CPU, in Kubernetes, is equivalent to:

            1 AWS vCPU
            1 GCP Core
            1 Azure vCore
            1 Hyperthread on a bare-metal Intel processor with Hyperthreading


            So, setting argument -cpus "2" tells the Container to attempt to use 2 CPUs.



            Also, CPU is always requested as an absolute quantity, never as a relative quantity; 0.1 is the same amount of CPU on a single-core, dual-core, or 48-core machine.






            share|improve this answer





























              0














              Thank Rico for explaining the CPU vs Core in Kubernetes context.



              I personally think that apisim solution is more suitable for my problem.



              I run the commands and find out I only have 2 allocatable cores:



              enter image description here



              I couldn't understand why until I found this:



              enter image description here



              Rico is right about my laptop should have 8 cores due to Hyperthreading. But the docker default settings throttle it to 2.



              Hope this help others.






              share|improve this answer





















                Your Answer






                StackExchange.ifUsing("editor", function () {
                StackExchange.using("externalEditor", function () {
                StackExchange.using("snippets", function () {
                StackExchange.snippets.init();
                });
                });
                }, "code-snippets");

                StackExchange.ready(function() {
                var channelOptions = {
                tags: "".split(" "),
                id: "1"
                };
                initTagRenderer("".split(" "), "".split(" "), channelOptions);

                StackExchange.using("externalEditor", function() {
                // Have to fire editor after snippets, if snippets enabled
                if (StackExchange.settings.snippets.snippetsEnabled) {
                StackExchange.using("snippets", function() {
                createEditor();
                });
                }
                else {
                createEditor();
                }
                });

                function createEditor() {
                StackExchange.prepareEditor({
                heartbeatType: 'answer',
                autoActivateHeartbeat: false,
                convertImagesToLinks: true,
                noModals: true,
                showLowRepImageUploadWarning: true,
                reputationToPostImages: 10,
                bindNavPrevention: true,
                postfix: "",
                imageUploader: {
                brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
                contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
                allowUrls: true
                },
                onDemand: true,
                discardSelector: ".discard-answer"
                ,immediatelyShowMarkdownHelp:true
                });


                }
                });














                draft saved

                draft discarded


















                StackExchange.ready(
                function () {
                StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53255956%2fkubernetes-meaning-of-cpu-and-core%23new-answer', 'question_page');
                }
                );

                Post as a guest















                Required, but never shown

























                4 Answers
                4






                active

                oldest

                votes








                4 Answers
                4






                active

                oldest

                votes









                active

                oldest

                votes






                active

                oldest

                votes









                2














                To remove any guess work regarding your laptop or any other environment, execute



                kubectl get nodes


                ...and then this for a particular node:



                kubectl describe node <node-name>


                Look for cpu under Allocatable (which may have the same value as under Capacity).



                Take into consideration that



                1 CPU = 1000 millicores/millicpu


                when setting "fractional" resources.requests.cpu and resources.limits.cpu for containers.






                share|improve this answer


























                  2














                  To remove any guess work regarding your laptop or any other environment, execute



                  kubectl get nodes


                  ...and then this for a particular node:



                  kubectl describe node <node-name>


                  Look for cpu under Allocatable (which may have the same value as under Capacity).



                  Take into consideration that



                  1 CPU = 1000 millicores/millicpu


                  when setting "fractional" resources.requests.cpu and resources.limits.cpu for containers.






                  share|improve this answer
























                    2












                    2








                    2






                    To remove any guess work regarding your laptop or any other environment, execute



                    kubectl get nodes


                    ...and then this for a particular node:



                    kubectl describe node <node-name>


                    Look for cpu under Allocatable (which may have the same value as under Capacity).



                    Take into consideration that



                    1 CPU = 1000 millicores/millicpu


                    when setting "fractional" resources.requests.cpu and resources.limits.cpu for containers.






                    share|improve this answer












                    To remove any guess work regarding your laptop or any other environment, execute



                    kubectl get nodes


                    ...and then this for a particular node:



                    kubectl describe node <node-name>


                    Look for cpu under Allocatable (which may have the same value as under Capacity).



                    Take into consideration that



                    1 CPU = 1000 millicores/millicpu


                    when setting "fractional" resources.requests.cpu and resources.limits.cpu for containers.







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Nov 13 at 1:25









                    apisim

                    4376




                    4376

























                        3














                        To clarify what's described here in the Kubernetes context, 1 CPU is the same as a core.



                        1000m (milicores) = 1 core = 1 CPU = 1 AWS vCPU = 1 GCP Core.
                        100m (milicores) = 0.1 core = 0.1 CPU = 0.1 AWS vCPU = 0.1 GCP Core.


                        For example, an Intel Core i7-6700 has 4 cores but it has Hyperthreading which doubles what the system sees in terms of cores. So in essence, it will show up in Kubernetes as:



                        8000m = 8 cores = 8 CPUs


                        Some extra info, these resources are managed by the kube-scheduler using the Completely Fair Scheduler (CFS) and the are no guarantees in terms of overruns within the same machine and your pod may be moved around.



                        If you'd like to have stronger guarantees you might consider the --cpu-manager-policy=static (CPU Manager) option in the kubelet. More information here and here.






                        share|improve this answer























                        • Sorry, I don't understand how it can be 1 core = 1 cpu? For my laptop environment, what is the maximum resource I can allocate?
                          – GMsoF
                          Nov 12 at 5:45










                        • whats the processor in your laptop?
                          – Rico
                          Nov 12 at 6:18










                        • it is normal intel cpu i7-6700, 4 cores.
                          – GMsoF
                          Nov 12 at 6:25










                        • so it's an i7 that means it has hyperthreading, which makes it look like that it has 8 cores. So there will be 8 cores/CPUs available to Kubernetes. Added more details to the answer
                          – Rico
                          Nov 12 at 14:59


















                        3














                        To clarify what's described here in the Kubernetes context, 1 CPU is the same as a core.



                        1000m (milicores) = 1 core = 1 CPU = 1 AWS vCPU = 1 GCP Core.
                        100m (milicores) = 0.1 core = 0.1 CPU = 0.1 AWS vCPU = 0.1 GCP Core.


                        For example, an Intel Core i7-6700 has 4 cores but it has Hyperthreading which doubles what the system sees in terms of cores. So in essence, it will show up in Kubernetes as:



                        8000m = 8 cores = 8 CPUs


                        Some extra info, these resources are managed by the kube-scheduler using the Completely Fair Scheduler (CFS) and the are no guarantees in terms of overruns within the same machine and your pod may be moved around.



                        If you'd like to have stronger guarantees you might consider the --cpu-manager-policy=static (CPU Manager) option in the kubelet. More information here and here.






                        share|improve this answer























                        • Sorry, I don't understand how it can be 1 core = 1 cpu? For my laptop environment, what is the maximum resource I can allocate?
                          – GMsoF
                          Nov 12 at 5:45










                        • whats the processor in your laptop?
                          – Rico
                          Nov 12 at 6:18










                        • it is normal intel cpu i7-6700, 4 cores.
                          – GMsoF
                          Nov 12 at 6:25










                        • so it's an i7 that means it has hyperthreading, which makes it look like that it has 8 cores. So there will be 8 cores/CPUs available to Kubernetes. Added more details to the answer
                          – Rico
                          Nov 12 at 14:59
















                        3












                        3








                        3






                        To clarify what's described here in the Kubernetes context, 1 CPU is the same as a core.



                        1000m (milicores) = 1 core = 1 CPU = 1 AWS vCPU = 1 GCP Core.
                        100m (milicores) = 0.1 core = 0.1 CPU = 0.1 AWS vCPU = 0.1 GCP Core.


                        For example, an Intel Core i7-6700 has 4 cores but it has Hyperthreading which doubles what the system sees in terms of cores. So in essence, it will show up in Kubernetes as:



                        8000m = 8 cores = 8 CPUs


                        Some extra info, these resources are managed by the kube-scheduler using the Completely Fair Scheduler (CFS) and the are no guarantees in terms of overruns within the same machine and your pod may be moved around.



                        If you'd like to have stronger guarantees you might consider the --cpu-manager-policy=static (CPU Manager) option in the kubelet. More information here and here.






                        share|improve this answer














                        To clarify what's described here in the Kubernetes context, 1 CPU is the same as a core.



                        1000m (milicores) = 1 core = 1 CPU = 1 AWS vCPU = 1 GCP Core.
                        100m (milicores) = 0.1 core = 0.1 CPU = 0.1 AWS vCPU = 0.1 GCP Core.


                        For example, an Intel Core i7-6700 has 4 cores but it has Hyperthreading which doubles what the system sees in terms of cores. So in essence, it will show up in Kubernetes as:



                        8000m = 8 cores = 8 CPUs


                        Some extra info, these resources are managed by the kube-scheduler using the Completely Fair Scheduler (CFS) and the are no guarantees in terms of overruns within the same machine and your pod may be moved around.



                        If you'd like to have stronger guarantees you might consider the --cpu-manager-policy=static (CPU Manager) option in the kubelet. More information here and here.







                        share|improve this answer














                        share|improve this answer



                        share|improve this answer








                        edited Nov 12 at 15:01

























                        answered Nov 12 at 5:22









                        Rico

                        25.9k94864




                        25.9k94864












                        • Sorry, I don't understand how it can be 1 core = 1 cpu? For my laptop environment, what is the maximum resource I can allocate?
                          – GMsoF
                          Nov 12 at 5:45










                        • whats the processor in your laptop?
                          – Rico
                          Nov 12 at 6:18










                        • it is normal intel cpu i7-6700, 4 cores.
                          – GMsoF
                          Nov 12 at 6:25










                        • so it's an i7 that means it has hyperthreading, which makes it look like that it has 8 cores. So there will be 8 cores/CPUs available to Kubernetes. Added more details to the answer
                          – Rico
                          Nov 12 at 14:59




















                        • Sorry, I don't understand how it can be 1 core = 1 cpu? For my laptop environment, what is the maximum resource I can allocate?
                          – GMsoF
                          Nov 12 at 5:45










                        • whats the processor in your laptop?
                          – Rico
                          Nov 12 at 6:18










                        • it is normal intel cpu i7-6700, 4 cores.
                          – GMsoF
                          Nov 12 at 6:25










                        • so it's an i7 that means it has hyperthreading, which makes it look like that it has 8 cores. So there will be 8 cores/CPUs available to Kubernetes. Added more details to the answer
                          – Rico
                          Nov 12 at 14:59


















                        Sorry, I don't understand how it can be 1 core = 1 cpu? For my laptop environment, what is the maximum resource I can allocate?
                        – GMsoF
                        Nov 12 at 5:45




                        Sorry, I don't understand how it can be 1 core = 1 cpu? For my laptop environment, what is the maximum resource I can allocate?
                        – GMsoF
                        Nov 12 at 5:45












                        whats the processor in your laptop?
                        – Rico
                        Nov 12 at 6:18




                        whats the processor in your laptop?
                        – Rico
                        Nov 12 at 6:18












                        it is normal intel cpu i7-6700, 4 cores.
                        – GMsoF
                        Nov 12 at 6:25




                        it is normal intel cpu i7-6700, 4 cores.
                        – GMsoF
                        Nov 12 at 6:25












                        so it's an i7 that means it has hyperthreading, which makes it look like that it has 8 cores. So there will be 8 cores/CPUs available to Kubernetes. Added more details to the answer
                        – Rico
                        Nov 12 at 14:59






                        so it's an i7 that means it has hyperthreading, which makes it look like that it has 8 cores. So there will be 8 cores/CPUs available to Kubernetes. Added more details to the answer
                        – Rico
                        Nov 12 at 14:59













                        0














                        As mentioned here, https://kubernetes.io/docs/tasks/configure-pod-container/assign-cpu-resource/



                        It clearly says that,



                        The CPU resource is measured in CPU units. One CPU, in Kubernetes, is equivalent to:

                        1 AWS vCPU
                        1 GCP Core
                        1 Azure vCore
                        1 Hyperthread on a bare-metal Intel processor with Hyperthreading


                        So, setting argument -cpus "2" tells the Container to attempt to use 2 CPUs.



                        Also, CPU is always requested as an absolute quantity, never as a relative quantity; 0.1 is the same amount of CPU on a single-core, dual-core, or 48-core machine.






                        share|improve this answer


























                          0














                          As mentioned here, https://kubernetes.io/docs/tasks/configure-pod-container/assign-cpu-resource/



                          It clearly says that,



                          The CPU resource is measured in CPU units. One CPU, in Kubernetes, is equivalent to:

                          1 AWS vCPU
                          1 GCP Core
                          1 Azure vCore
                          1 Hyperthread on a bare-metal Intel processor with Hyperthreading


                          So, setting argument -cpus "2" tells the Container to attempt to use 2 CPUs.



                          Also, CPU is always requested as an absolute quantity, never as a relative quantity; 0.1 is the same amount of CPU on a single-core, dual-core, or 48-core machine.






                          share|improve this answer
























                            0












                            0








                            0






                            As mentioned here, https://kubernetes.io/docs/tasks/configure-pod-container/assign-cpu-resource/



                            It clearly says that,



                            The CPU resource is measured in CPU units. One CPU, in Kubernetes, is equivalent to:

                            1 AWS vCPU
                            1 GCP Core
                            1 Azure vCore
                            1 Hyperthread on a bare-metal Intel processor with Hyperthreading


                            So, setting argument -cpus "2" tells the Container to attempt to use 2 CPUs.



                            Also, CPU is always requested as an absolute quantity, never as a relative quantity; 0.1 is the same amount of CPU on a single-core, dual-core, or 48-core machine.






                            share|improve this answer












                            As mentioned here, https://kubernetes.io/docs/tasks/configure-pod-container/assign-cpu-resource/



                            It clearly says that,



                            The CPU resource is measured in CPU units. One CPU, in Kubernetes, is equivalent to:

                            1 AWS vCPU
                            1 GCP Core
                            1 Azure vCore
                            1 Hyperthread on a bare-metal Intel processor with Hyperthreading


                            So, setting argument -cpus "2" tells the Container to attempt to use 2 CPUs.



                            Also, CPU is always requested as an absolute quantity, never as a relative quantity; 0.1 is the same amount of CPU on a single-core, dual-core, or 48-core machine.







                            share|improve this answer












                            share|improve this answer



                            share|improve this answer










                            answered Nov 12 at 4:32









                            prisoner_of_azkaban

                            139114




                            139114























                                0














                                Thank Rico for explaining the CPU vs Core in Kubernetes context.



                                I personally think that apisim solution is more suitable for my problem.



                                I run the commands and find out I only have 2 allocatable cores:



                                enter image description here



                                I couldn't understand why until I found this:



                                enter image description here



                                Rico is right about my laptop should have 8 cores due to Hyperthreading. But the docker default settings throttle it to 2.



                                Hope this help others.






                                share|improve this answer


























                                  0














                                  Thank Rico for explaining the CPU vs Core in Kubernetes context.



                                  I personally think that apisim solution is more suitable for my problem.



                                  I run the commands and find out I only have 2 allocatable cores:



                                  enter image description here



                                  I couldn't understand why until I found this:



                                  enter image description here



                                  Rico is right about my laptop should have 8 cores due to Hyperthreading. But the docker default settings throttle it to 2.



                                  Hope this help others.






                                  share|improve this answer
























                                    0












                                    0








                                    0






                                    Thank Rico for explaining the CPU vs Core in Kubernetes context.



                                    I personally think that apisim solution is more suitable for my problem.



                                    I run the commands and find out I only have 2 allocatable cores:



                                    enter image description here



                                    I couldn't understand why until I found this:



                                    enter image description here



                                    Rico is right about my laptop should have 8 cores due to Hyperthreading. But the docker default settings throttle it to 2.



                                    Hope this help others.






                                    share|improve this answer












                                    Thank Rico for explaining the CPU vs Core in Kubernetes context.



                                    I personally think that apisim solution is more suitable for my problem.



                                    I run the commands and find out I only have 2 allocatable cores:



                                    enter image description here



                                    I couldn't understand why until I found this:



                                    enter image description here



                                    Rico is right about my laptop should have 8 cores due to Hyperthreading. But the docker default settings throttle it to 2.



                                    Hope this help others.







                                    share|improve this answer












                                    share|improve this answer



                                    share|improve this answer










                                    answered Nov 13 at 7:41









                                    GMsoF

                                    3,19495393




                                    3,19495393






























                                        draft saved

                                        draft discarded




















































                                        Thanks for contributing an answer to Stack Overflow!


                                        • Please be sure to answer the question. Provide details and share your research!

                                        But avoid



                                        • Asking for help, clarification, or responding to other answers.

                                        • Making statements based on opinion; back them up with references or personal experience.


                                        To learn more, see our tips on writing great answers.





                                        Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                                        Please pay close attention to the following guidance:


                                        • Please be sure to answer the question. Provide details and share your research!

                                        But avoid



                                        • Asking for help, clarification, or responding to other answers.

                                        • Making statements based on opinion; back them up with references or personal experience.


                                        To learn more, see our tips on writing great answers.




                                        draft saved


                                        draft discarded














                                        StackExchange.ready(
                                        function () {
                                        StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53255956%2fkubernetes-meaning-of-cpu-and-core%23new-answer', 'question_page');
                                        }
                                        );

                                        Post as a guest















                                        Required, but never shown





















































                                        Required, but never shown














                                        Required, but never shown












                                        Required, but never shown







                                        Required, but never shown

































                                        Required, but never shown














                                        Required, but never shown












                                        Required, but never shown







                                        Required, but never shown







                                        Popular posts from this blog

                                        Florida Star v. B. J. F.

                                        Danny Elfman

                                        Lugert, Oklahoma