📄 Kubernetes YAML Generator

Kubernetes YAML Generator - Enter name, image, port and replicas to produce a Deployment plus Service manifest. Free, browser-only.

📐 工作原理与说明
应用名取输入值(为空时用默认名),镜像取输入值(为空时用默认镜像),端口取输入值向下取整(无效时取 80),副本数取输入值向下取整并保证至少为 1。按模板拼装 Kubernetes 清单:Deployment 段依次写入接口版本、资源类型、应用名、副本数、以应用名为值的标签选择器,以及容器名、镜像与容器端口;随后以分隔线接 Service 段,写入接口版本、资源类型、应用名、以应用名为值的选择器、服务端口与目标端口(二者同为上述端口值)与集群内访问类型。输出时对整段 YAML 做 HTML 转义后在代码块中展示
生成 Kubernetes 资源清单 YAML。
  • 必填字段:apiVersion、kind、metadata、spec。
  • 关联:Deployment 的 selector 必须与 Pod template 的标签匹配;Service 通过 selector 选中 Pod。
  • 资源:requests 决定调度,limits 决定使用上限,二者应合理设置。
  • 建议:同时配置 readiness/liveness 探针,避免流量打入未就绪的 Pod。

Formula & Standard References

Item Formula / Note Source / Standard
Required fields apiVersion, kind and metadata.name are the minimum Kubernetes API reference
Resource versioning apiVersion as group/version; core group omits the group Kubernetes API conventions
Label selectors selector must match the template labels Kubernetes API conventions
⚠️ 使用说明与注意事项

📋 清单结构

Deployment(副本/镜像)+ Service(暴露);用 --- 分隔多文档。资源限制(resources)、探针建议另行补充。