【发布时间】:2021-11-06 19:52:11
【问题描述】:
我有 3 个应用程序位于不同的目录中,由 kubernetes 清单文件处理。
我想使用 terraform 将所有应用程序部署在不同的目录中。
应用程序的结构如下所示。
app-1
L kubernetes_manifest
L deployment.yaml. ## use Dockerfile to run the app
L app
L app.py
Dockerfile. ## wrap the app
app-2
L kubernetes_manifest
L deployment.yaml. ## use Dockerfile to run the app
L app
L app.py
Dockerfile. ## wrap the app
app-3
L kubernetes_manifest
L deployment.yaml. ## use Dockerfile to run the app
L app
L app.py
Dockerfile. ## wrap the app
app_terraform
L main.tf
main.tf
resource "google_container_cluster" "test_cluster" {
project = "test"
name = "test-cluster"
initial_node_count = 1
}
有没有办法部署main.tf中的所有应用程序?
【问题讨论】:
-
应用源码和k8s manifests在git或其他scm/vcs中是如何组织的?
-
我不会在同一个仓库中拥有集群管理和应用程序——它们以不同的速度和不同的意图发生变化。虽然,有可能拥有它。
-
@MattSchuchard 我将
app.py之类的源代码包装在一个Dockerfile 中,并使用该dockerfile 作为deployment.yaml 中的容器来运行。我在每个应用程序的根目录下使用 GIT。
标签: kubernetes terraform terraform-provider-gcp