如何在Terraform和kubernetes_igress_v1中拥有多个主机



问题很简单,但我在网上找不到一个例子。。。基本上你是如何用kubernetes_ingressv1在Terraform中写这篇文章的。我基本上有一个应用程序,由于路径重叠,我正在为每个组件使用子域。

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: ingress-wildcard-host
spec:
rules:
- host: "foo.bar.com"
http:
paths:
- pathType: Prefix
path: "/bar"
backend:
service:
name: service1
port:
number: 80
- host: "*.foo.com"
http:
paths:
- pathType: Prefix
path: "/foo"
backend:
service:
name: service2
port:
number: 80

对于kubernetes_engress_v1,要在同一个入口上有多个主机,我必须使用多个规则。

resource "kubernetes_ingress_v1" "monitoring" {
metadata {
name        = "monitoring-alb"
namespace   = "monitoring"
annotations = {
"kubernetes.io/ingress.class" = "alb"
#More annotation##
}
}
spec {
rule {
host = "monitoring.mydomain.io"
http {
path {
path_type = "ImplementationSpecific"
backend {
service {
name = "grafana"
port {
number = 80
}
}
}
}
}
}
rule {
host = "logs.mydomain.io"
http {
path {
path_type = "ImplementationSpecific"
backend {
service {
name = "loki-distributed-gateway"
port {
number = 80
}
}
}
}
}
}
}
}

相关内容

  • 没有找到相关文章

最新更新