Kubernetes Engine API Connector Overview

The Workflows connector defines the built-in functions that can be used to access other Google Cloud products within a workflow.

This page provides an overview of the individual connector. There is no need to import or load connector libraries in a workflow—connectors work out of the box when used in a call step.

Kubernetes Engine API

Builds and manages container-based applications, powered by the open source Kubernetes technology. To learn more, see the Kubernetes Engine API documentation.

Kubernetes Engine connector sample

YAML

# This workflow demonstrates how to use the Google Kubernetes Engine (GKE) connector:
# Create a GKE cluster and then delete it
# Each step waits until the long-running operation of creating or deleting the cluster completes
# Expected output: "SUCCESS"
main:
  params: []
  steps:
    - init:
        assign:
          - project_id: ${sys.get_env("GOOGLE_CLOUD_PROJECT_ID")}
          - cluster_zone: "us-central1-a"
          - cluster_id: "CLUSTER_ID"  # replace CLUSTER_ID placeholder
          - cluster_full_name: ${"projects/" + project_id + "/locations/" + cluster_zone + "/clusters/" + cluster_id}
    - create_gke_cluster:
        call: googleapis.container.v1.projects.zones.clusters.create
        args:
          projectId: ${project_id}
          zone: ${cluster_zone}
          body:
            cluster:
              name: ${cluster_id}
              initial_node_count: 1
            parent: ${"projects/" + project_id + "/locations/" + cluster_zone}
    - assert_running:
        call: assert_cluster_status
        args:
          expected_status: "RUNNING"
          project_id: ${project_id}
          cluster_zone: ${cluster_zone}
          cluster_id: ${cluster_id}
          cluster_full_name: ${cluster_full_name}
    - delete_gke_cluster:
        call: googleapis.container.v1.projects.zones.clusters.delete
        args:
          projectId: ${project_id}
          zone: ${cluster_zone}
          clusterId: ${cluster_id}
          name: ${cluster_full_name}
    - the_end:
        return: "SUCCESS"

assert_cluster_status:
  params:
    [expected_status, project_id, cluster_zone, cluster_id, cluster_full_name]
  steps:
    - get_cluster:
        call: googleapis.container.v1.projects.zones.clusters.get
        args:
          projectId: ${project_id}
          zone: ${cluster_zone}
          clusterId: ${cluster_id}
          name: ${cluster_full_name}
        result: cluster
    - compare:
        switch:
          - condition: ${cluster.status == expected_status}
            next: end
    - fail:
        raise: ${"Expected VM status is " + expected_status + ". Received " + cluster.status + " instead."}

JSON

{
  "main": {
    "params": [],
    "steps": [
      {
        "init": {
          "assign": [
            {
              "project_id": "${sys.get_env(\"GOOGLE_CLOUD_PROJECT_ID\")}"
            },
            {
              "cluster_zone": "us-central1-a"
            },
            {
              "cluster_id": "CLUSTER_ID"
            },
            {
              "cluster_full_name": "${\"projects/\" + project_id + \"/locations/\" + cluster_zone + \"/clusters/\" + cluster_id}"
            }
          ]
        }
      },
      {
        "create_gke_cluster": {
          "call": "googleapis.container.v1.projects.zones.clusters.create",
          "args": {
            "projectId": "${project_id}",
            "zone": "${cluster_zone}",
            "body": {
              "cluster": {
                "name": "${cluster_id}",
                "initial_node_count": 1
              },
              "parent": "${\"projects/\" + project_id + \"/locations/\" + cluster_zone}"
            }
          }
        }
      },
      {
        "assert_running": {
          "call": "assert_cluster_status",
          "args": {
            "expected_status": "RUNNING",
            "project_id": "${project_id}",
            "cluster_zone": "${cluster_zone}",
            "cluster_id": "${cluster_id}",
            "cluster_full_name": "${cluster_full_name}"
          }
        }
      },
      {
        "delete_gke_cluster": {
          "call": "googleapis.container.v1.projects.zones.clusters.delete",
          "args": {
            "projectId": "${project_id}",
            "zone": "${cluster_zone}",
            "clusterId": "${cluster_id}",
            "name": "${cluster_full_name}"
          }
        }
      },
      {
        "the_end": {
          "return": "SUCCESS"
        }
      }
    ]
  },
  "assert_cluster_status": {
    "params": [
      "expected_status",
      "project_id",
      "cluster_zone",
      "cluster_id",
      "cluster_full_name"
    ],
    "steps": [
      {
        "get_cluster": {
          "call": "googleapis.container.v1.projects.zones.clusters.get",
          "args": {
            "projectId": "${project_id}",
            "zone": "${cluster_zone}",
            "clusterId": "${cluster_id}",
            "name": "${cluster_full_name}"
          },
          "result": "cluster"
        }
      },
      {
        "compare": {
          "switch": [
            {
              "condition": "${cluster.status == expected_status}",
              "next": "end"
            }
          ]
        }
      },
      {
        "fail": {
          "raise": "${\"Expected VM status is \" + expected_status + \". Received \" + cluster.status + \" instead.\"}"
        }
      }
    ]
  }
}

Module: googleapis.container.v1.projects.aggregated.usableSubnetworks

Functions
list Lists subnetworks that are usable for creating clusters in a project.

Module: googleapis.container.v1.projects.locations

Functions
getServerConfig Returns configuration info about the Google Kubernetes Engine service.

Module: googleapis.container.v1.projects.locations.clusters

Functions
completeIpRotation Completes master IP rotation.
create Creates a cluster, consisting of the specified number and type of Google Compute Engine instances. By default, the cluster is created in the project's default network. One firewall is added for the cluster. After cluster creation, the Kubelet creates routes for each node to allow the containers on that node to communicate with all other instances in the cluster. Finally, an entry is added to the project's global metadata indicating which CIDR range the cluster is using.
delete Deletes the cluster, including the Kubernetes endpoint and all worker nodes. Firewalls and routes that were configured during cluster creation are also deleted. Other Google Compute Engine resources that might be in use by the cluster, such as load balancer resources, are not deleted if they weren't present when the cluster was initially created.
get Gets the details of a specific cluster.
getJwks Gets the public component of the cluster signing keys in JSON Web Key format. This API is not yet intended for general use, and is not available for all clusters.
list Lists all clusters owned by a project in either the specified zone or all zones.
setAddons Sets the addons for a specific cluster.
setLegacyAbac Enables or disables the ABAC authorization mechanism on a cluster.
setLocations Sets the locations for a specific cluster. Deprecated. Use projects.locations.clusters.update instead.
setLogging Sets the logging service for a specific cluster.
setMaintenancePolicy Sets the maintenance policy for a cluster.
setMasterAuth Sets master auth materials. Currently supports changing the admin password or a specific cluster, either via password generation or explicitly setting the password.
setMonitoring Sets the monitoring service for a specific cluster.
setNetworkPolicy Enables or disables Network Policy for a cluster.
setResourceLabels Sets labels on a cluster.
startIpRotation Starts master IP rotation.
update Updates the settings of a specific cluster.
updateMaster Updates the master for a specific cluster.

Module: googleapis.container.v1.projects.locations.clusters.nodePools

Functions
create Creates a node pool for a cluster.
delete Deletes a node pool from a cluster.
get Retrieves the requested node pool.
list Lists the node pools for a cluster.
rollback Rolls back a previously Aborted or Failed NodePool upgrade. This makes no changes if the last upgrade successfully completed.
setAutoscaling Sets the autoscaling settings for the specified node pool.
setManagement Sets the NodeManagement options for a node pool.
setSize Sets the size for a specific node pool. The new size will be used for all replicas, including future replicas created by modifying NodePool.locations.
update Updates the version and/or image type for the specified node pool.

Module: googleapis.container.v1.projects.locations.clusters.well_known

Functions
getOpenid_configuration Gets the OIDC discovery document for the cluster. See the OpenID Connect Discovery 1.0 specification for details. This API is not yet intended for general use, and is not available for all clusters.

Module: googleapis.container.v1.projects.locations.operations

Functions
cancel Cancels the specified operation.
get Gets the specified operation.
list Lists all operations in a project in a specific zone or all zones.

Module: googleapis.container.v1.projects.zones

Functions
getServerconfig Returns configuration info about the Google Kubernetes Engine service.

Module: googleapis.container.v1.projects.zones.clusters

Functions
addons Sets the addons for a specific cluster.
completeIpRotation Completes master IP rotation.
create Creates a cluster, consisting of the specified number and type of Google Compute Engine instances. By default, the cluster is created in the project's default network. One firewall is added for the cluster. After cluster creation, the Kubelet creates routes for each node to allow the containers on that node to communicate with all other instances in the cluster. Finally, an entry is added to the project's global metadata indicating which CIDR range the cluster is using.
delete Deletes the cluster, including the Kubernetes endpoint and all worker nodes. Firewalls and routes that were configured during cluster creation are also deleted. Other Google Compute Engine resources that might be in use by the cluster, such as load balancer resources, are not deleted if they weren't present when the cluster was initially created.
get Gets the details of a specific cluster.
legacyAbac Enables or disables the ABAC authorization mechanism on a cluster.
list Lists all clusters owned by a project in either the specified zone or all zones.
locations Sets the locations for a specific cluster. Deprecated. Use projects.locations.clusters.update instead.
logging Sets the logging service for a specific cluster.
master Updates the master for a specific cluster.
monitoring Sets the monitoring service for a specific cluster.
resourceLabels Sets labels on a cluster.
setMaintenancePolicy Sets the maintenance policy for a cluster.
setMasterAuth Sets master auth materials. Currently supports changing the admin password or a specific cluster, either via password generation or explicitly setting the password.
setNetworkPolicy Enables or disables Network Policy for a cluster.
startIpRotation Starts master IP rotation.
update Updates the settings of a specific cluster.

Module: googleapis.container.v1.projects.zones.clusters.nodePools

Functions
autoscaling Sets the autoscaling settings for the specified node pool.
create Creates a node pool for a cluster.
delete Deletes a node pool from a cluster.
get Retrieves the requested node pool.
list Lists the node pools for a cluster.
rollback Rolls back a previously Aborted or Failed NodePool upgrade. This makes no changes if the last upgrade successfully completed.
setManagement Sets the NodeManagement options for a node pool.
setSize Sets the size for a specific node pool. The new size will be used for all replicas, including future replicas created by modifying NodePool.locations.
update Updates the version and/or image type for the specified node pool.

Module: googleapis.container.v1.projects.zones.operations

Functions
cancel Cancels the specified operation.
get Gets the specified operation.
list Lists all operations in a project in a specific zone or all zones.

Module: googleapis.container.v1beta1.projects.aggregated.usableSubnetworks

Functions
list Lists subnetworks that can be used for creating clusters in a project.

Module: googleapis.container.v1beta1.projects.locations

Functions
getServerConfig Returns configuration info about the Google Kubernetes Engine service.
list Fetches locations that offer Google Kubernetes Engine.

Module: googleapis.container.v1beta1.projects.locations.clusters

Functions
completeIpRotation Completes master IP rotation.
create Creates a cluster, consisting of the specified number and type of Google Compute Engine instances. By default, the cluster is created in the project's default network. One firewall is added for the cluster. After cluster creation, the Kubelet creates routes for each node to allow the containers on that node to communicate with all other instances in the cluster. Finally, an entry is added to the project's global metadata indicating which CIDR range the cluster is using.
delete Deletes the cluster, including the Kubernetes endpoint and all worker nodes. Firewalls and routes that were configured during cluster creation are also deleted. Other Google Compute Engine resources that might be in use by the cluster, such as load balancer resources, are not deleted if they weren't present when the cluster was initially created.
get Gets the details for a specific cluster.
getJwks Gets the public component of the cluster signing keys in JSON Web Key format. This API is not yet intended for general use, and is not available for all clusters.
list Lists all clusters owned by a project in either the specified zone or all zones.
setAddons Sets the addons for a specific cluster.
setLegacyAbac Enables or disables the ABAC authorization mechanism on a cluster.
setLocations Sets the locations for a specific cluster. Deprecated. Use projects.locations.clusters.update instead.
setLogging Sets the logging service for a specific cluster.
setMaintenancePolicy Sets the maintenance policy for a cluster.
setMasterAuth Sets master auth materials. Currently supports changing the admin password or a specific cluster, either via password generation or explicitly setting the password.
setMonitoring Sets the monitoring service for a specific cluster.
setNetworkPolicy Enables or disables Network Policy for a cluster.
setResourceLabels Sets labels on a cluster.
startIpRotation Starts master IP rotation.
update Updates the settings for a specific cluster.
updateMaster Updates the master for a specific cluster.

Module: googleapis.container.v1beta1.projects.locations.clusters.nodePools

Functions
create Creates a node pool for a cluster.
delete Deletes a node pool from a cluster.
get Retrieves the requested node pool.
list Lists the node pools for a cluster.
rollback Rolls back a previously Aborted or Failed NodePool upgrade. This makes no changes if the last upgrade successfully completed.
setAutoscaling Sets the autoscaling settings of a specific node pool.
setManagement Sets the NodeManagement options for a node pool.
setSize SetNodePoolSizeRequest sets the size of a node pool. The new size will be used for all replicas, including future replicas created by modifying NodePool.locations.
update Updates the version and/or image type of a specific node pool.

Module: googleapis.container.v1beta1.projects.locations.clusters.well_known

Functions
getOpenid_configuration Gets the OIDC discovery document for the cluster. See the OpenID Connect Discovery 1.0 specification for details. This API is not yet intended for general use, and is not available for all clusters.

Module: googleapis.container.v1beta1.projects.locations.operations

Functions
cancel Cancels the specified operation.
get Gets the specified operation.
list Lists all operations in a project in the specified zone or all zones.

Module: googleapis.container.v1beta1.projects.zones

Functions
getServerconfig Returns configuration info about the Google Kubernetes Engine service.

Module: googleapis.container.v1beta1.projects.zones.clusters

Functions
addons Sets the addons for a specific cluster.
completeIpRotation Completes master IP rotation.
create Creates a cluster, consisting of the specified number and type of Google Compute Engine instances. By default, the cluster is created in the project's default network. One firewall is added for the cluster. After cluster creation, the Kubelet creates routes for each node to allow the containers on that node to communicate with all other instances in the cluster. Finally, an entry is added to the project's global metadata indicating which CIDR range the cluster is using.
delete Deletes the cluster, including the Kubernetes endpoint and all worker nodes. Firewalls and routes that were configured during cluster creation are also deleted. Other Google Compute Engine resources that might be in use by the cluster, such as load balancer resources, are not deleted if they weren't present when the cluster was initially created.
get Gets the details for a specific cluster.
legacyAbac Enables or disables the ABAC authorization mechanism on a cluster.
list Lists all clusters owned by a project in either the specified zone or all zones.
locations Sets the locations for a specific cluster. Deprecated. Use projects.locations.clusters.update instead.
logging Sets the logging service for a specific cluster.
master Updates the master for a specific cluster.
monitoring Sets the monitoring service for a specific cluster.
resourceLabels Sets labels on a cluster.
setMaintenancePolicy Sets the maintenance policy for a cluster.
setMasterAuth Sets master auth materials. Currently supports changing the admin password or a specific cluster, either via password generation or explicitly setting the password.
setNetworkPolicy Enables or disables Network Policy for a cluster.
startIpRotation Starts master IP rotation.
update Updates the settings for a specific cluster.

Module: googleapis.container.v1beta1.projects.zones.clusters.nodePools

Functions
autoscaling Sets the autoscaling settings of a specific node pool.
create Creates a node pool for a cluster.
delete Deletes a node pool from a cluster.
get Retrieves the requested node pool.
list Lists the node pools for a cluster.
rollback Rolls back a previously Aborted or Failed NodePool upgrade. This makes no changes if the last upgrade successfully completed.
setManagement Sets the NodeManagement options for a node pool.
setSize SetNodePoolSizeRequest sets the size of a node pool. The new size will be used for all replicas, including future replicas created by modifying NodePool.locations.
update Updates the version and/or image type of a specific node pool.

Module: googleapis.container.v1beta1.projects.zones.operations

Functions
cancel Cancels the specified operation.
get Gets the specified operation.
list Lists all operations in a project in the specified zone or all zones.