| 用途 | 用清单整体替换现网对象 |
|---|---|
| 语法 | kubectl replace -f <文件>;kubectl replace --force -f <文件> |
常用示例
常用示例
kubectl replace -f svc.yaml
kubectl replace --force -f svc.yaml
kubectl get svc web -o yaml > web.yaml && vi web.yaml && kubectl replace -f web.yamlreplace 要求对象已存在(不存在报错,用 apply/create 创建);--force 是删除后立即重建,Service 会短暂中断。