Setting up the Google Compute Engine Cloud Provider


In this section, you’ll learn how to enable the Google Compute Engine (GCE) cloud provider for custom clusters in Rancher. A custom cluster is one in which Rancher installs Kubernetes on existing nodes.

The official Kubernetes documentation for the GCE cloud provider is here.

Prerequisites: The service account of Identity and API access on GCE needs the Computer Admin permission.

If you are using Calico,

  1. Click ☰ > Cluster Management.
  2. On the Clusters page, go to the custom cluster and click *⋮ > Edit YAML. Enter the following configuration:

    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"

If you are using Canal or Flannel,

  1. Click ☰ > Cluster Management.
  2. On the Clusters page, go to the custom cluster and click *⋮ > Edit YAML. Enter the following configuration:

    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