Google

在本部分中,您将学习如何为 Rancher 中的自定义集群启用 Google Compute Engine(GCE)Cloud Provider。在自定义集群中,Rancher 可以将 Kubernetes 集群安装在现有节点上。

GCE Cloud Provider 的官方 Kubernetes 文档在此处

前提条件: GCE 上 的 Identity and API 服务账号需要 Computer Admin 权限。

如果您使用 Calico,

  1. 转到 Rancher UI 中的集群视图,然后单击 省略号 >编辑

  2. 单击编辑 YAML,然后输入以下配置:

    1. rancher_kubernetes_engine_config:
    2. cloud_provider:
    3. name: gce
    4. customCloudProvider: |-
    5. [Global]
    6. project-id=<your project ID, optional>
    7. network-name=<your network, optional if using default network>
    8. subnetwork-name=<your subnetwork of the above network, optional if using default network>
    9. node-instance-prefix=<your instance group name/your instance name specific prefix, required>
    10. node-tags=<your network tags, must patch one or some tags, required>
    11. network:
    12. options:
    13. calico_cloud_provider: "gce"
    14. plugin: "calico"

    Copy

如果您使用 Canal 或 Flannel,

  1. 转到 Rancher UI 中的集群视图,然后单击 省略号 >编辑

  2. 单击编辑 YAML,然后输入以下配置:

    1. rancher_kubernetes_engine_config:
    2. cloud_provider:
    3. name: gce
    4. customCloudProvider: |-
    5. [Global]
    6. project-id=<your project ID, optional>
    7. network-name=<your network, optional if using default network>
    8. subnetwork-name=<your subnetwork of the above network, optional if using default network>
    9. node-instance-prefix=<your instance group name/your instance name specific prefix, required>
    10. node-tags=<your network tags, must patch one or some tags, required>
    11. services:
    12. kube_controller:
    13. extra_args:
    14. configure-cloud-routes: true # we need to allow the cloud provider configure the routes for the hosts

    Copy