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
  • 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

Pre-requisites

  • kubernetes cluster
  • kubectl
  • helm

Installation

# install off of pypi
pip install 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

# create the docker-compose.yaml
cat > docker-compose.yaml << EOF
version: '3'
x-kubernetes:
  # this is the helm chart release name and namespace
  name: test
  namespace: default
services:
  # a deployment is created with this name
  test-web:
    image: nginx:latest
    ports:
      # a service is created exposing this port
      - 80
    x-kubernetes:
      # these are the kubernetes annotations added to the deployment
      annotations:
        # this annotation causes a ingress to be created for the deployment
        maayanlab.cloud/ingress: http://localhost
EOF

# start the docker-compose service(s) on the kubernetes cluster
kube-compose 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.2.0.tar.gz (13.5 kB view details)

Uploaded Source

Built Distribution

kube_compose-0.2.0-py3-none-any.whl (20.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: kube_compose-0.2.0.tar.gz
  • Upload date:
  • Size: 13.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.2 CPython/3.12.3 Linux/6.8.9-arch1-1

File hashes

Hashes for kube_compose-0.2.0.tar.gz
Algorithm Hash digest
SHA256 5937007650ed879cf9be520abacbff8c3a02cb68a78800d7a6da01f32151a860
MD5 02761e2fe33157c437a4dc928f0a898a
BLAKE2b-256 08744b8e8abd8a5f868e373ab5466511d29b99e97f461bde9f5f3e55dbe787eb

See more details on using hashes here.

File details

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

File metadata

  • Download URL: kube_compose-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 20.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.2 CPython/3.12.3 Linux/6.8.9-arch1-1

File hashes

Hashes for kube_compose-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 96eaa262c43b6436817f425088ec2a9f6248d67c8648eb20c28093a15daccf43
MD5 a57e426cd617e02519ab3bc8a03bb125
BLAKE2b-256 d4e26b9398941450460245e5baa30a2ffc8da734c527bfc3cf0cc715e4ce0ad1

See more details on using hashes here.

Supported by

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