Giter Club home page Giter Club logo

chakra's Introduction

Chakra ๐Ÿฅ

Chakra is a highly customizable Kubernetes scheduler that makes Kubernetes schedule jobs as you want them to be scheduled.

The goal of Chakra is ease of use and flexibility. It is not designed for performance, and is not suitable for production use.

Currently supported policies:

  • Random
  • Best Fit Binpacking

Usage

Chakra runs as a deployment inside your Kubernetes cluster. It watches all pod that have pod.spec.schedulerName set to chakra, and schedules them according to the chosen policy.

To use Chakra:

  1. Launch the Chakra deployment
# Setup permissions
kubectl apply -f chakra_admin.yaml
# You can configure the policy being deployed by editing chakra.yaml
kubectl apply -f chakra.yaml
  1. Submit pods with pod.spec.schedulerName set to chakra and make sure resource limits and requests are the same. For example:
apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx
spec:
  template:
    spec:
      schedulerName: chakra # <--- This is critical! This is how the pod is assigned to Chakra for scheduling.
      containers:
        resources:
          requests:
            cpu: 1
            nvidia.com/gpu: 1
          limits: # Must be same as requests
            cpu: 1
            nvidia.com/gpu: 1
        ...
  1. Check logs with kubectl logs -f chakra-<pod-id>

Developer Notes

Setting up your debug cluster

cd tests

# Create a 3 node kind cluster
kind create cluster --config kind-cluster.yaml

# Add fake GPU resources to these nodes:
# Before running this script, run `kubectl proxy` in a separate terminal.
python add_gpus_kind.py

# Now you can experimeent with this cluster by submitting nginx pods with schedulerName set to chakra. This yaml also uses the fake GPUs.
kubectl apply -f nginx.yaml

Running Chakra outside of Kubernetes

You can also run Chakra outside of Kubernetes using --kubeconfig flag to point to a kubeconfig file. This is useful for development and debugging.

# Random policy
python3 -m chakra.main --policy random --kubeconfig ~/.kube/config

# Binpacking policy
python3 -m chakra.main --policy binpack --policy-args '{"binpacking_resource": "cpu"}' --kubeconfig ~/.kube/config

Adding your own Policy

Take a look at chakra/policies.py. You'll need to inherit from BaseClass and implement the get_allocation method.

Known issues

  • Please report!

chakra's People

Contributors

romilbhardwaj avatar michaelzhiluo 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.