我正在尝试使用#Pulumi来设置
- # GKE服务入口
- 使用HTTPS负载均衡器
- 与谷歌管理的SSL证书。由于某些原因,入口创建永远停留在"正在创建入口"。
我正在使用GCE入口控制器。有我可以参考的工作例子吗?如果你需要更多的信息,请随时询问,我很乐意提供。下面是我到目前为止尝试过的代码片段(经过无数次尝试才达到这个状态)。我错过了什么?
# kubernetes # gcp
const authDeploymentService = new k8s.core.v1.Service(authDeploymentName,
{
metadata: {
name: "auth-svc",
labels: authDeploymentAppLabels,
namespace: namespaceName,
},
spec: {
type: "LoadBalancer",
ports: [{ port: 80, targetPort: 8080 }],
selector: authDeploymentAppLabels,
},
},
{
provider: clusterProvider,
dependsOn: [authDeployment]
}
);
const authServiceManagedCert = new gcp.compute.ManagedSslCertificate("auth-cert-001", {
name: "auth-cert-001",
project: myGcpProject.projectId,
description: "Managed SSL Certificate For auth service",
managed: {
domains: [
"mydomain.com"
]
}
});
const managedCertConfigMap = new k8s.core.v1.ConfigMap("managed-certificate-config", {
data: {
"1": pulumi.interpolate`{"Key":{"Namespace":"${namespaceName}","Name":"${authServiceManagedCert.name}"},"Value":{"ExcludedFromSLO":false,"SoftDeleted":false,"SslCertificateName":"${authServiceManagedCert.id}","SslCertificateBindingReported":true,"SslCertificateCreationReported":true}}}`
},
metadata: {
name: "managed-certificate-config",
namespace: "kube-system",
}
})
const ingress = new k8s.networking.v1beta1.Ingress(authDeploymentName + "-ingress", {
metadata: {
namespace: namespaceName,
annotations: {
"ingress.gcp.kubernetes.io/pre-shared-cert": authServiceManagedCert.name,
"networking.gke.io/managed-certificates": authServiceManagedCert.name
}
},
spec: {
ingressClassName: "gce",
backend: {
serviceName: authDeploymentService.metadata.name,
servicePort: 80
},
tls: [
{
hosts: ["mydomain.com"],
}
],
rules: [
{
host: "mydomain.com",
http: {
paths: [
{
path: "/",
backend: {
serviceName: authDeploymentService.metadata.name,
servicePort: authDeploymentService.spec.ports[0].port,
},
}
],
},
},
]
}
},
{
provider: clusterProvider,
dependsOn: [managedCertConfigMap]
});
好吧,如果有人偶然发现这个,我找到了一个关键输入,感谢这篇文章…我使用的是networking/v1beta
(显然已弃用)而不是networking/v1
。一旦我切换到v1,我开始看到不同的行为,如后端,前端,目标代理等被自动创建。
我只希望Pulumi更新它的文档来反映这一点,这样像我这样的人就不会纠结了。