我喜欢 Kuberenetes 的工作方法,使用自包含的图像并将配置作为卷传递到 ConfigMap 中。
现在这很好用,直到我尝试用 Liquibase 容器做这件事,SQL 很长 ~1.5K 行,Kubernetes 拒绝它太长。
来自 Kubernetes 的错误:
ConfigMap“liquibase-test-content”无效:metadata.annotations:太长:最多必须有 262144 个字符
我想将.sql
文件作为hostPath
,但据我所知,这些hostPath
内容可能不会存在
还有其他方法可以将配置从 K8s 目录传递到 pods 吗?谢谢。
the*_*dog 22
从1.18开始你可以使用服务器端apply来规避这个问题。
kubectl apply --server-side=true -f foo.yml
其中server-side=true
在服务器而不是客户端上运行 apply 命令。
这将正确显示与其他参与者的冲突,包括客户端应用,从而失败:
Apply failed with 4 conflicts: conflicts with "kubectl-client-side-apply" using apiextensions.k8s.io/v1:
- .status.conditions
- .status.storedVersions
- .status.acceptedNames.kind
- .status.acceptedNames.plural
Please review the fields above--they currently have other managers. Here
are the ways you can resolve this warning:
* If you intend to manage all of these fields, please re-run the apply
command with the `--force-conflicts` flag.
* If you do not intend to manage all of the fields, please edit your
manifest to remove references to the fields that should keep their
current managers.
* You may co-own fields by updating your manifest to match the existing
value; in this case, you'll become the manager if the other manager(s)
stop managing the field (remove it from their configuration).
See http://k8s.io/docs/reference/using-api/api-concepts/#conflicts
Run Code Online (Sandbox Code Playgroud)
如果想要进行更改,您可以简单地使用第一个选项:
kubectl apply --server-side=true --force-conflicts -f foo.yml
您可以为此使用 init 容器。本质上,将.sql
文件放在 GitHub 或 S3 或任何您可以从中读取并使用它填充目录的位置。init 容器的语义保证 Liquibase 容器仅在配置文件下载后才会启动。
归档时间: |
|
查看次数: |
5441 次 |
最近记录: |