Coder Social home page Coder Social logo

cpuset-device-plugin's Introduction

Kubernetes CPU Device Plugin

Expose CPU resources as consumable devices in Kubernetes.

Prerequisites

  • Enable PodResources feature gates in the kubelet configuration and restart the kubelet.
    # /var/lib/kubelet/config.yaml
    # ...
    featureGates:
        KubeletPodResources: true
        KubeletPodResourcesGet: true
        KubeletPodResourcesGetAllocatable: true

Installation

  1. Clone the repository and navigate to the root directory.

     git clone https://github.com/stefanaki/cpuset-device-plugin.git
     cd cpuset-device-plugin
  2. Edit the environment variables of the DaemonSet to match your system.

     # manifests/cpuset-device-plugin-daemonset.yaml
     # ...
      containers:
       - image: stefanaki/cpuset-device-plugin:0.0.1
         imagePullPolicy: Always
         args:
           - "--node-name=$(NODE_NAME)"
           - "--container-runtime=docker"
           - "--cgroups-path=/sys/fs/cgroup"
           - "--cgroups-driver=systemd"
     # ...
  3. Apply the device plugin manifest.

    kubectl apply -f manifests/cpuset-device-plugin-daemonset.yaml

Usage

You can view the available CPU resources by describing the node.

kubectl describe node <node-name>
# ...
Capacity:
  cpu:                          16
  ephemeral-storage:            967735612Ki
  hugepages-1Gi:                0
  hugepages-2Mi:                0
  memory:                       14161548Ki
  pods:                         110
  stefanaki.github.com/core:    8
  stefanaki.github.com/cpu:     16
  stefanaki.github.com/numa:    1
  stefanaki.github.com/socket:  1

In your pod specification, you can request an amount of numa/socket/core/cpu resources.

containers:
- name: benchmark
  image: spirals/parsec-3.0
  resources:
    requests:
      "cpu": "4000m"
      "stefanaki.github.com/core": "2"
    limits:
      "cpu": "4000m"
      "stefanaki.github.com/core": "2"

The daemon will set the cpuset.cpus and cpuset.mems of the container to the requested resources.

cpuset-device-plugin's People

Contributors

stefanaki avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.