Skip to main content

An opinionated way of deploying docker-compose to kubernetes clusters by managing them with a helm chart.

Project description

kube-compose

An opinionated way of deploying docker-compose to kubernetes clusters by managing them with a helm chart.

The CLI is intended to be easy to use for those familiar with docker-compose and includes some additional features. Basically all features expect you to have a docker-compose.yaml file in the working directory.

  • kube-compose init => specify the helm release name/namespace in your docker-compose.yaml file
  • docker-compose-like features
    • kube-compose up => helm install/upgrade + volume create (pvc)
    • kube-compose down => helm uninstall
    • kube-compose ps => helm status
    • kube-compose logs SERVICE => kubectl logs
    • kube-compose exec SERVICE => kubectl exec
    • kube-compose restart SERVICE => kubectl rollout restart
    • kube-compose top SERVICE => kubectl exec pod -- cat /proc/*/stats
    • kube-compose stats SERVICE => kubectl top pod
    • kube-compose events SERVICE => kubectl events
    • kube-compose start SERVICE => kubectl scale --replicas={compose_defined}
    • kube-compose scale SERVICE => kubectl scale --replicas={user_specified}
    • kube-compose stop SERVICE => kubectl scale --replicas=0
  • helm-like features
    • kube-compose ls => helm list
    • kube-compose template => helm template
    • kube-compose history => helm history
    • kube-compose status => helm status
    • kube-compose get WHAT => helm get WHAT
    • kube-compose rollback REVISION => helm rollback REVISION
  • additional features
    • kube-compose volume ... => manage docker-compose defined volumes as persistent volume claims
      • kube-compose volume create [VOLUME] => create the claim(s)
      • kube-compose volume rm [VOLUME] => delete the claim(s)
    • kube-compose diff => diff -Naur <(helm get values) <(docker-compose config)
    • kube-compose version SERVICE [<newversion> | major | minor | patch] => like npm version but for services in the docker-compose.yaml
    • kube-compose port-forward SERVICE local:remote

Pre-requisites

  • kubernetes cluster
  • kubectl
  • helm
  • docker-compose

Installation

# install off of pypi
pip install kube-compose

# verify install was successful
kube-compose --help

CLI Usage with Docker

# Assuming your kubeconfig is at the default location ~/.kube/config
alias kube-compose="docker run -v .:/work -v ~/.kube/config:/work/.kube/config -it u8sand/kube-compose"

# verify install was successful
kube-compose --help

End-to-end Example with K3D

# launch a test kubernetes cluster
k3d cluster create -a1 -p "80:80@loadbalancer" -p "443:443@loadbalancer"

# one option for auto-creating Ingress resources from annotations on the deployment
helm repo add maayanlab https://maayanlab.github.io/helm-charts
helm install kubernetes-auto-ingress maayanlab/kubernetes-auto-ingress --set ingressClassName=traefik

# 
# start the docker-compose service(s) on the kubernetes cluster
kube-compose -f tests/units/simple/docker-compose.yaml up

# verify it's running at http://localhost

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

kube_compose-0.3.0.tar.gz (15.0 kB view details)

Uploaded Source

Built Distribution

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

kube_compose-0.3.0-py3-none-any.whl (27.7 kB view details)

Uploaded Python 3

File details

Details for the file kube_compose-0.3.0.tar.gz.

File metadata

  • Download URL: kube_compose-0.3.0.tar.gz
  • Upload date:
  • Size: 15.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.12.0 Linux/6.15.2-arch1-1

File hashes

Hashes for kube_compose-0.3.0.tar.gz
Algorithm Hash digest
SHA256 770a6d938bff16934fede1e014ecce79e063ada43b78e959231af5047f389016
MD5 6c403a31b15475805e444e8f7d3630b1
BLAKE2b-256 459d777c373f3259de53dbac67a563a19fae6f27f9cd1677b5a0471e2e394d2d

See more details on using hashes here.

File details

Details for the file kube_compose-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: kube_compose-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 27.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.12.0 Linux/6.15.2-arch1-1

File hashes

Hashes for kube_compose-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 71b426f6b4de38ce7f0fcfc3b27ef216be2566c293e50af2da1add1d78bc03aa
MD5 f37659327eb6563c16211d90f1eaa8e3
BLAKE2b-256 96963516c6512e9da4576e9d2a21ac345d1fc96d8a5926addb09ff1b23adaa30

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