kubepose
A minimalist tool to convert Compose specification files to Kubernetes manifests
Why kubepose?
kubepose provides a simpler alternative to kompose, focusing solely on converting Compose specifications to Kubernetes YAML files with:
- โจ Zero Configuration Your compose file is the only input needed
- ๐ฏ Predictable Output Generates clean, standard Kubernetes manifests
- ๐ Immutable by Default Secrets and configmaps are created immutably
Installation
# Using go install
go install github.com/middle-management/kubepose/cmd/kubepose@latest
# Or download latest release from https://github.com/middle-management/kubepose/releases
curl -L "https://github.com/middle-management/kubepose/releases/latest/download/kubepose-$(uname -s)-$(uname -m)" -o kubepose
# Make it executable
chmod +x kubepose
# Move it somewhere in your PATH
sudo mv kubepose /usr/local/bin/
Verify the signature of the release
The releases are signed using cosign. To verify the signature, you need to install cosign first.
# first download the certificate and signature files
curl -L "https://github.com/middle-management/kubepose/releases/latest/download/kubepose-$(uname -s)-$(uname -m).pem" -o kubepose-$(uname -s)-$(uname -m).pem
curl -L "https://github.com/middle-management/kubepose/releases/latest/download/kubepose-$(uname -s)-$(uname -m).sig" -o kubepose-$(uname -s)-$(uname -m).sig
# then use cosign to verify the signature
cosign verify-blob \
--certificate kubepose-$(uname -s)-$(uname -m).pem \
--signature kubepose-$(uname -s)-$(uname -m).sig \
--certificate-identity "https://github.com/middle-management/kubepose/.github/workflows/release.yaml@refs/tags/<tag-version>" \
--certificate-oidc-issuer "https://token.actions.githubusercontent.com" \
kubepose-$(uname -s)-$(uname -m)
Quick Start
# Convert compose files to K8s manifests
kubepose convert
# Specify input files explicitly
kubepose convert -f compose.yaml -f compose.prod.yaml
# Use with kubectl
kubepose convert | kubectl apply -n my-ns -f -
# Use with specific profiles
kubepose convert -p prod
kubepose follows the same file lookup order as docker compose
:
compose.yaml
compose.yml
docker-compose.yaml
docker-compose.yml
Examples
The tests in the testdata
directory are integration tests which also work as examples of various Compose configurations and their corresponding Kubernetes output. Each feature has its own directory with a compose.yaml
and its converted Kubernetes manifests in the TestConvert
directory. See testdata/simple/compose.yaml
and its corresponding testdata/TestConvert/simple/k8s.yaml
as an example.
Key Features
- ๐ฎ Simple CLI - Single command with familiar
-f
and -p
flags
- ๐ Application First - Focus on deploying applications, not managing clusters
- ๐ Standard Conversion - Predictable mapping to Kubernetes resources
- ๐ฆ No Dependencies - Single binary with zero runtime requirements
- ๐ฏ Targeted Scope - Focused purely on Compose to Kubernetes conversion
Supported Resources
Core Workloads
Feature |
Status |
Description |
Deployments |
โ
|
Default workload type |
DaemonSets |
โ
|
Enable with deploy.mode: global |
Multi-Container Pods |
โ
|
Group via kompose.service.group |
Init Containers |
โ
|
Mark with kubepose.container.type: init |
Sidecar Containers |
โ
|
Init containers with restart: always |
StatefulSets |
๐ง |
Planned |
CronJobs |
๐ง |
Planned |
Container Configuration
Feature |
Status |
Description |
Image & Tags |
โ
|
Full support for image references |
Commands |
โ
|
Both command and entrypoint |
Update Strategies |
โ
|
Configurable update behavior |
Environment |
โ
|
Variables and values |
Working Directory |
โ
|
Via working_dir |
Shell Access |
โ
|
stdin_open and tty |
Resource Limits |
โ
|
CPU and memory constraints |
Health Checks |
โ
|
Supports test commands and HTTP checks |
User Settings |
โ
|
Numeric user/group IDs only |
Networking
Feature |
Status |
Description |
Ports |
โ
|
TCP/UDP port mapping |
Service Exposure |
โ
|
Via Kubernetes annotations |
Internal DNS |
โ |
Use Kubernetes DNS instead |
Custom Networks |
โ |
Use Kubernetes networking |
Storage & State
Feature |
Status |
Description |
Named Volumes |
โ
|
Converts to PersistentVolumeClaims |
Bind Mounts |
โ
|
Creates ConfigMaps for files |
Host Paths |
โ
|
Via kubepose.volume.hostPath label |
Tmpfs |
โ
|
Maps to emptyDir with Memory medium |
Volume Labels |
โ
|
Preserved in K8s resources |
Configuration & Secrets
Feature |
Status |
Description |
File-based Secrets |
โ
|
Creates Kubernetes Secrets |
Environment Secrets |
โ
|
Creates Kubernetes Secrets |
External Secrets |
โ
|
References existing K8s Secrets |
Labels |
โ
|
Preserved in K8s resources |
Annotations |
โ
|
Preserved in K8s resources |
Profiles |
โ
|
For environment-specific configs |
Unsupported Features
Some Docker Compose features are intentionally not supported as they either:
- Have no direct Kubernetes equivalent
- Are better handled by native Kubernetes features
- Fall outside kubepose's scope
Key unsupported features include:
- ๐ ๏ธ Build configuration (use
docker buildkit bake
)
- ๐ Container linking (use Kubernetes Services)
- ๐๏ธ Dependencies (use Kubernetes primitives)
- ๐ Privileged mode and capabilities
- ๐ Logging configuration
Best Practices
- Use Profiles for environment-specific configurations
- Leverage Labels for better resource organization
- Keep Secrets External when possible
- Use Standard Ports to maintain compatibility
Status Legend
Symbol |
Meaning |
โ
|
Fully Supported |
๐ง |
Coming Soon |
โ |
Not Supported |
Update Strategies
kubepose supports Docker Compose's update_config
for controlling how services are updated:
services:
web:
deploy:
update_config:
parallelism: 2 # How many containers to update at once
order: start-first # Update strategy: start-first, stop-first
delay: 10s # Minimum time between updates
monitor: 60s # Time to monitor for failure
The configuration maps to Kubernetes deployment strategies as follows:
Compose Config |
Deployment |
DaemonSet |
Description |
order: start-first |
RollingUpdate with maxUnavailable: 0 |
RollingUpdate with maxSurge |
Start new pods before stopping old |
order: stop-first |
Recreate |
RollingUpdate with maxUnavailable |
Stop old pods before starting new |
parallelism |
maxSurge /maxUnavailable |
maxSurge /maxUnavailable |
Number of pods updated at once |
delay |
minReadySeconds |
minReadySeconds |
Time between updates |
monitor |
progressDeadlineSeconds |
N/A |
Time to monitor for failures |
Example configurations:
# Rolling update that starts new pods first
services:
web:
deploy:
update_config:
order: start-first
parallelism: 2
# Stop all pods before starting new ones
services:
db:
deploy:
update_config:
order: stop-first
# Gradual rollout with monitoring
services:
api:
deploy:
update_config:
parallelism: 1
delay: 30s
monitor: 60s
Note that some aspects of Docker Compose's update configuration don't have direct equivalents in Kubernetes:
failure_action
is handled differently through Kubernetes' native deployment controller
max_failure_ratio
has no direct equivalent
Contributing
Contributions are welcome! See our Contributing Guide for details.
License
MIT License