Kubernetes CPU multithreading

后端 未结 3 1807
庸人自扰
庸人自扰 2021-01-04 02:03

I have a 4 cores CPU, I create a Kubernetes Pod with CPU resource limit 100m, which mean it will occupy 1/10 of a core power.

I wondering in this case, 100m is not e

3条回答
  •  南方客
    南方客 (楼主)
    2021-01-04 02:23

    Take a look to this documentation related to resources in Kubernetes:

    You can use resources as described in the article:

    To specify a CPU request for a Container, include the resources:requests field in the Container resource manifest. To specify a CPU limit, include resources:limits.

    In this exercise, you create a Pod that has one Container. The Container has a request of 0.5 CPU and a limit of 1 CPU. Here is the configuration file for the Pod:

    apiVersion: v1
    kind: Pod
    metadata:
      name: cpu-demo
      namespace: cpu-example
    spec:
      containers:
      - name: cpu-demo-ctr
        image: vish/stress
        resources:
          limits:
            cpu: "1"
          requests:
            cpu: "0.5"
        args:
        - -cpus
        - "2"
    

    Additional to your question: Yes it is not gonna run in parallels (multi core threads). But you can show few core for your application in pod and then use multi threads to execute it.

    The args section of the configuration file provides arguments for the Container when it starts. The -cpus "2" argument tells the Container to attempt to use 2 CPUs.

提交回复
热议问题