Coder Social home page Coder Social logo

kubepy's Introduction

kubepy

Latest Version Supported Python versions Wheel Status License

Python wrapper on kubectl that makes deploying easy.

Installation

Requires python 3.5 and configured kubectl. To install run: pip3 install kubepy

Usage

You can use this package to install all yml definitions from given directory. Just run kubepy-apply-all from a directory where all of you Kubernetes definition yml files are.

Supported Kubernetes resources:

  • CronJob
  • Deployment
  • StatefulSet
  • Job
  • Pod (used to run a one-off command)
  • Service
  • Ingress
  • Secret
  • StorageClass
  • PersistentVolume
  • PersistentVolumeClaim
  • PodDisruptionBudget

Options:

  • --directory <path> - uses path instead of local directory. Can be used multiple times to add new and partially override existing definitions.
  • --build-tag <tag> - sets tag to all images without specified tag in your definition files
  • --label <key>=<value> - adds label to definition. Can be used multiple times.
  • --label-pod <key>=<value> - adds label to each pod definition. Can be used multiple times.
  • --annotate <key>=<value> - adds annotation to definition. Can be used multiple times.
  • --annotate-pod <key>=<value> - adds annotation to each pod definition. Can be used multiple times.
  • --replace - if present, replaces deployments instead of updating them. Default: false.
  • --host-volume <name>=<path> Adds host volume to each pod definition. Can be used multiple times.
  • --env <VAR>=value Sets environment variable on every container.
  • --max-job-retries <n> While waiting for job to finish if it fails n times than delete job and fail. Job sometimes can still be executed more than n times.

There is also kubepy-apply-one command which is called as kubepy-apply-one name1 [name2 ...] It applies only files selected files. Names should be without ".yml". It accepts all options from kubepy-apply-all. Additionally you can pass option:

  • --show-definition - shows definition instead of applying them.

Applying jobs.

Applying usualy means that underlying kubectl apply or kubectl replace is called. However applying job is treated differently. To ensure that job finished and succeeded kubectl waits for job to finish and fails if job failed.

Applying pods.

Usually you don't need to apply pods manually, but if you want to run some kind of check and you need to know if it succeeded without retries then you can use pod with restartPolicy: Never. Only pods with this policy are currently supported. They are treated as jobs, so applying waits for them to finish and fails if they fail.

kubepy's People

Contributors

behoston avatar glowka avatar jgoclawski avatar kramarz avatar maruqu avatar riklaunim avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

kubepy's Issues

Add option --dont-replicate

In development I would like to set all "replicas" to 1. It is easier to debug and requires less resources.

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.