Gir*_*ish 5 kubernetes kubectl kustomize
出于 CI/CD 的目的,该项目正在维护 2 个 kustomization.yaml 文件
要运行 kustomize build,当前目录中需要一个名为“kustomization.yaml”的文件。如果项目要使用 kustomization_rollback.yaml 而不是 kustomization.yaml,这怎么可能?kustomize 是否接受文件名作为参数?文档对此没有指定任何内容。
目前无法更改行为kustomize以支持其他文件名(通过使用预编译的二进制文件):
kustomization.yamlkustomization.ymlKustomization以下所有情况都会产生相同的错误输出:
kubectl kustomize dir/kubectl apply -k dir/kustomize build dir/Error: unable to find one of 'kustomization.yaml', 'kustomization.yml' or 'Kustomization' in directory 'FULL_PATH/dir'
Run Code Online (Sandbox Code Playgroud)
根据 CI/CD 平台/解决方案/工具,您应该尝试其他方法,例如:
Deployment2 个目录kustomization_deploy/kustomization_rollback与kustomization.yaml作为旁注!
kustomize 使用的文件名放置在:
/kubernetes/vendor/sigs.k8s.io/kustomize/pkg/constants/constants.goRun Code Online (Sandbox Code Playgroud)// Package constants holds global constants for the kustomize tool. package constants // KustomizationFileNames is a list of filenames that can be recognized and consumbed // by Kustomize. // In each directory, Kustomize searches for file with the name in this list. // Only one match is allowed. var KustomizationFileNames = []string{ "kustomization.yaml", "kustomization.yml", "Kustomization", }选择文件背后的逻辑
Kustomization位于:
/kubernetes/vendor/sigs.k8s.io/kustomize/pkg/target/kusttarget.go
附加参考:
| 归档时间: |
|
| 查看次数: |
1371 次 |
| 最近记录: |