【发布时间】:2021-09-14 23:15:12
【问题描述】:
我有一个应该公开 2 个端口的应用程序,并且该应用程序没有返回 200 的默认运行状况检查端点 /,所以目前,我只为 1 个端口提供自定义运行状况检查端点.我还没有公开其他端口,因为我不知道如何为同一个应用程序提供另一个自定义运行状况检查端点。
这就是我的 Terraform 配置的样子。
resource "kubernetes_deployment" "core" {
metadata {
name = "core"
labels = {
app = "core"
}
}
spec {
replicas = 1
selector {
match_labels = {
app = "core"
}
}
template {
metadata {
labels = {
app = "core"
}
}
spec {
container {
name = "core"
image = "asia.gcr.io/admin/core:${var.app_version}"
port {
container_port = 8069
}
readiness_probe {
http_get {
path = "/web/database/selector"
port = "8069"
}
initial_delay_seconds = 15
period_seconds = 30
}
image_pull_policy = "IfNotPresent"
}
}
}
}
}
resource "kubernetes_service" "core_service" {
metadata {
name = "core-service"
}
spec {
type = "NodePort"
selector = {
app = "core"
}
port {
port = 8080
protocol = "TCP"
target_port = "8069"
}
}
}
如何告诉 GKE 公开另一个端口 (8072) 并为两个端口使用自定义运行状况检查端点?
【问题讨论】:
标签: kubernetes google-cloud-platform terraform google-kubernetes-engine