docker-to-k8s-manifests

ClawSkills 作者 clawskills v1.0.0

Automatically generate optimized Kubernetes deployment manifests from Dockerfile and docker-compose configurations with proper resource limits and health checks.

安装 / 下载方式

TotalClaw CLI推荐
totalclaw install clawskills:clawskills~martinforsulu-neo-docker-to-k8s-manifests
cURL直接下载,无需登录
curl -fsSL https://skills.taituai.com/api/skills/clawskills%3Aclawskills~martinforsulu-neo-docker-to-k8s-manifests/file -o martinforsulu-neo-docker-to-k8s-manifests.md
# docker-to-k8s-manifests

Converts Dockerfile and docker-compose.yml files into production-ready Kubernetes deployment manifests.

## Usage

### CLI

```bash
# From a Dockerfile
docker-to-k8s --dockerfile ./Dockerfile --output ./k8s/

# From a docker-compose.yml
docker-to-k8s --compose ./docker-compose.yml --output ./k8s/

# With custom app name
docker-to-k8s --dockerfile ./Dockerfile --name my-app --output ./k8s/
```

### As a library

```javascript
const { DockerfileParser } = require('./scripts/dockerfile-parser');
const { ComposeParser } = require('./scripts/compose-parser');
const { K8sGenerator } = require('./scripts/k8s-generator');

// Parse Dockerfile
const parser = new DockerfileParser();
const config = parser.parseFile('./Dockerfile');

// Generate K8s manifests
const generator = new K8sGenerator();
const manifests = generator.generate(config, { name: 'my-app' });
```

## Features

- Parses Dockerfile instructions and extracts metadata
- Parses docker-compose.yml multi-service configurations
- Generates Deployment, Service, and Ingress manifests
- Estimates resource limits based on application type
- Configures liveness, readiness, and startup probes
- Validates output against Kubernetes schemas
- Applies security best practices (non-root, read-only FS, dropped capabilities)

## Output

Generates the following Kubernetes resources:

- **Deployment** — with resource limits, probes, security context
- **Service** — ClusterIP with correct port mappings
- **Ingress** — optional, for HTTP services
- **ConfigMap** — for environment variables
- **PersistentVolumeClaim** — for volume mounts