docker-to-k8s-manifests
通过 Dockerfile 和 docker-compose 配置自动生成优化的 Kubernetes 部署清单,并进行适当的资源限制和运行状况检查。
安装 / 下载方式
TotalClaw CLI推荐
totalclaw install totalclaw:totalclaw~martinforsulu-neo-docker-to-k8s-manifestscURL直接下载,无需登录
curl -fsSL https://skills.taituai.com/api/skills/totalclaw%3Atotalclaw~martinforsulu-neo-docker-to-k8s-manifests/file -o martinforsulu-neo-docker-to-k8s-manifests.md## 概述(中文)
通过 Dockerfile 和 docker-compose 配置自动生成优化的 Kubernetes 部署清单,并进行适当的资源限制和运行状况检查。
## 原文
# 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