使用自定义镜像创建Dataproc集群报错无法解析镜像版本
问题原因
- 参数使用错误:创建Dataproc集群时,
image_version参数仅支持填写官方提供的标准版本号,也就是报错信息中列出的可选值范围,不支持直接传入自定义镜像名称。 - 自定义镜像需要使用专用参数配置,且仅传入短名称无法被Dataproc正确识别,需要填写完整的镜像资源URI。
解决方法
- 如果你使用gcloud命令创建集群:
将原有配置里的--image-version my-ubuntu18-custom参数替换为--image my-ubuntu18-custom即可。如果自定义镜像和集群不在同一个GCP项目下,需要填写完整URI:gcloud dataproc clusters create 集群名称 --image projects/镜像所属项目ID/global/images/my-ubuntu18-custom 其余参数 - 如果你使用Terraform等基础设施即代码工具配置:
删掉software_config块下的image_version配置,新增image参数,值填写完整的镜像URI,示例配置如下:resource "google_dataproc_cluster" "demo_cluster" { name = "demo-cluster" region = "us-central1" cluster_config { software_config { # 注释或删除原有的image_version配置 # image_version = "my-ubuntu18-custom" image = "projects/你的项目ID/global/images/my-ubuntu18-custom" } # 其余集群配置省略 } } - 额外校验项:请确认你的自定义镜像是基于Dataproc官方基础镜像制作的,使用非Dataproc基础镜像制作的自定义镜像无法正常启动Dataproc集群。
内容的提问来源于stack exchange,提问作者Naga Vijayapuram
相关产品推荐
相关产品推荐

