小编ham*_*awi的帖子

有没有办法获取 GKE 负载均衡器的域而不是 IP?

编辑:我正在开发一个项目,每天以 100% 自动的方式在 GKE 上部署多个项目。我们的项目是用nodejs开发的,下面是伪代码:

projects = get_all_projects_today() // returns 15 projects for today (for example)

for project in projects
    deploy_to_GKE(project) //generate a deployment manifest for project and post it to GKE (using api call)
    public_ip = create_service_on_GKE(project, type=Loadbalancer) //generate a service manifest (type loadbalancer) for project, post it to GKE (using api call) and returns the public created ip address
    get_domain_from_ip(public_ip) //how to do this !
Run Code Online (Sandbox Code Playgroud)

部署的项目必须可以通过域名访问,而不是像这样的 IP:

appx.mysite.com, or
mysite.com/appx
Run Code Online (Sandbox Code Playgroud)

结束编辑

这是我使用的服务清单的示例:

{
    "kind": "Service",
    "apiVersion": "v1", …
Run Code Online (Sandbox Code Playgroud)

cookies dns load-balancing google-kubernetes-engine

4
推荐指数
2
解决办法
6260
查看次数