本页面上的部分或全部信息可能不适用于 Trusted Cloud by S3NS。
将应用部署到 aarch64、AMD64 或混合架构的 GKE 集群
默认情况下,Skaffold 会自动检测目标集群的架构,并构建与工作站架构匹配的映像,即使目标集群的架构是混合架构(x86 和 Arm)也是如此。
您还可以选择在 IDE 中添加环境变量,或在 skaffold.yaml
文件中添加参数来指定要构建的平台,这会覆盖 Skaffold 的自动检测。
如果您想在构建映像时替换 Skaffold 的自动检测,可以通过以下方式指定要为哪个平台构建映像:
以下列表显示了 IDE 的 Environment variables 字段中 SKAFFOLD_PLATFORM
环境变量的可能值。您还可以将这些值用于 CLI 中的 --platform
标志或 skaffold.yaml
文件中的 platforms
参数:
x86 |
Arm |
amd64 |
aarch64 |
linux/amd64 |
linux/aarch64 |
将环境变量添加到 IDE 的配置中
如需向 Cloud Code 的配置添加环境变量,请按以下步骤操作:
在 IDE 中,依次点击 Run > Edit Configurations。
在运行标签页的 Advanced Settings(高级设置)代码段下,在 Environment variables(环境变量)字段中输入您的环境变量。
例如:SKAFFOLD_PLATFORM=linux/aarch64
这会替换 Skaffold 的自动检测,并构建您指定的映像类型。您的 skaffold.yaml
文件保持不变。
如需指定要为哪个平台构建映像,请将 platforms
参数添加到 skaffold.yaml
文件中:
build:
platforms: ["linux/aarch64"]
artifacts:
- image: example
如需详细了解 Cloud Code 对 Arm 和混合架构 GKE 集群的支持,请参阅 Arm 支持。
获取支持
如需在 IntelliJ IDE 中提交反馈或报告问题,请前往
工具 >
Cloud Code >
帮助 / 简介 >
提交反馈或报告问题,在
GitHub 上报告问题。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-15。
[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["没有我需要的信息","missingTheInformationINeed","thumb-down"],["太复杂/步骤太多","tooComplicatedTooManySteps","thumb-down"],["内容需要更新","outOfDate","thumb-down"],["翻译问题","translationIssue","thumb-down"],["示例/代码问题","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-07-15。"],[[["Skaffold automatically detects the target cluster's architecture and builds a matching image, even in mixed-architecture environments."],["You can override Skaffold's automatic architecture detection by using the `SKAFFOLD_PLATFORM` environment variable in your IDE configurations."],["Alternatively, you can specify the build platform directly in your `skaffold.yaml` file using the `platforms` parameter."],["The `SKAFFOLD_PLATFORM` environment variable, `--platform` flag, or `platforms` parameter can be set to values like `amd64`, `linux/amd64`, `aarch64`, or `linux/aarch64` to define the desired architecture."]]],[]]