Skip to main content

KPM cli

Project description

[![Build Status](https://travis-ci.org/kubespray/kpm.svg?branch=master)](https://travis-ci.org/kubespray/kpm) [![Code Climate](https://codeclimate.com/github/kubespray/kpm/badges/gpa.svg)](https://codeclimate.com/github/kubespray/kpm) [![Coverage Status](https://coveralls.io/repos/github/kubespray/kpm/badge.svg?branch=master)](https://coveralls.io/github/kubespray/kpm?branch=master)


# KPM

KPM is a tool to deploy and manage applications stack on kubernetes.

KPM provides the glue between kubernetes resources (ReplicatSet, DaemonSet, Secrets...). it defines a package has a composition of kubernetes resources and dependencies to other packages.

## Key concepts

### Simplicity

Keep it simple for both users and packagers.

### Declarative and idempotent

Declare what should be deployed and let the system apply only required changes.

### Reproducible deployment

For production and QA, control of each components is fundamental.
Both, dependency declaration and version control in KPM allows to have a predictable application stack deployment.

### Dependencies management

To propose 'ready-to-deploy' applications, the 'packager' can set a dependency list.

### Patch/Paramaterization

KPM encourages to use and reuse directly the 'upstream' package of a component and adapt it to its own requirement:
- <b>Templates:</b> quickly replace values in a resource via jinja2 templates.
- <b>Patch:</b> While template is good, it's not enough. Sometime the value to be edited is not parametrized. In such case, KPM proposes to apply a 'patch' on the resource

### Packages Hub
Quickly compose an application by searching and pick existing components from a registry.

## Quick start

### Deploy application

In this example we will deploy [rocket.chat](https://github.com/RocketChat/Rocket.Chat) an opensource webchat platform:

```
$ pip install kpm
$ kpm deploy ant31/rocketchat --namespace rocket-chat
-> Deploying ant31/rocketchat
app version type name namespace status
------------------ ------- ---- ------------ ----------- --------
ant31/mongodb 1.0.0 svc mongodb rktchat changed
ant31/mongodb 1.0.0 rc mongodb rktchat changed
ant31/rocketchat 1.2.0 svc rocketchat rktchat changed
ant31/rocketchat 1.2.0 rc rocketchat rktchat changed
```

## Install kpm

##### From Pypi

kpm is a python2 package and available on pypi
```
$ sudo pip install kpm -U
````

##### From git

```
git clone https://github.com/kubespray/kpm.git kpm-cli
cd kpm-cli
sudo make install
```

### Configuration

KPM uses `kubectl` to communicate with the kubernetes cluster.
Check if the cluster is accessible:
```bash
$ kubectl version
Client Version: version.Info{Major:"1", Minor:"1", GitVersion:"v1.1.4", GitCommit:"a5949fea3a91d6a50f40a5684e05879080a4c61d", GitTreeState:"clean"}
Server Version: version.Info{Major:"1", Minor:"1", GitVersion:"v1.1.4", GitCommit:"a5949fea3a91d6a50f40a5684e05879080a4c61d", GitTreeState:"clean"}

```

### Customize an existing package
1. Create a new package
2. Edit manifest
3. Change variables
4. Patch custom metric
5. Upload package
6. login
7. push
8.Test

## Account registration
### Signup
### Login/Logout

## Search and deploy a package
### List a user package
#### Show/Pull
### deploy

## Create a new package
The quickest way to get started is to use the command `new`:

```
kpm new namespace/packagename [--with-comments]
```
It creates the directory namespace/packagename

#### Directory structure
A package is composed of a `templates` directory and a `manifest.yaml`.
```
.
├── manifest.yaml
└── templates
├── heapster-rc.yaml
└── heapster-svc.yaml
```
Optionaly, it's possible to add a `README.md` and a `LICENSE`.

#### Templates
The `templates` directory contains the kubernetes resources to deploy.
It accepts every kind of resources (rc,secrets,pods,svc...).

Resources can be templated with Jinja2.

> We recommend to parametrize only values that should be overrided.
> Having a very light templated resources improve readability and quickly point to users which values are
> important to look at and change. User can use 'patch' to add their custom values.

You can declare the deploy order inside the `manifest.yaml`

#### Manifest
The `manifest.yaml` contains the following keys:

- package: metadata around the package and the packager
- variables: map jinja2 variables to default value
- resources: the list of resources, `file` refers to a filename inside the 'template' directory
- deploy: list the dependencies, a special keyword `$self` indicate to deploy current package.

```yaml
package:
name: ant31/heapster
author: "Antoine Legrand <2t.antoine@gmail.com>"
version: 0.18.2
description: Kubernetes data
license: MIT

variables:
namespace: kube-system
replicas: 1
image: "gcr.io/google_containers/heapster:v0.18.2"
svc_type: "NodePort"

resources:
- file: heapster-svc.yaml
name: heapster
type: svc

- file: heapster-rc.yaml
name: heapster
type: rc

deploy:
- name: $self
```
#### Publish

## Compose a package
### Dependency
#### Show manifest
#### variables
#### Patch
#### Shards

## Clustered applications/Shards
### Introduction
### Sharded: yes
### Shard list


=======
History
=======

0.1.0 (2016-2-22)
------------------

* First release on PyPI.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kpm-0.12.1.tar.gz (27.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

kpm-0.12.1-py2.py3-none-any.whl (18.6 kB view details)

Uploaded Python 2Python 3

File details

Details for the file kpm-0.12.1.tar.gz.

File metadata

  • Download URL: kpm-0.12.1.tar.gz
  • Upload date:
  • Size: 27.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for kpm-0.12.1.tar.gz
Algorithm Hash digest
SHA256 c90e2e30ac44ef9007c15a2716c14fd0b1cfd642fbe2c7d9eb732543f9b43a8e
MD5 5e76d921b42722cae61c7dda9a9d8785
BLAKE2b-256 ca81351cb457090b8c6fa6258c8cfd2dd667f317c2075907a9cfeee007e214d1

See more details on using hashes here.

File details

Details for the file kpm-0.12.1-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for kpm-0.12.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 1e5afe267baae64232937cde3749cb2dd64b2063d67ebd395a345916dd1bb484
MD5 0ea0d095cc3501f8c37c564edb6f2fd9
BLAKE2b-256 317253d1eb57b0f3e3ed0b4c9bc1d3b8ef7326b949c21b0399e6e9e07b8905c5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page