Shutdown Hours Lab

Determine if an Ocean-GKE Shielded Node workaround is required

To implement shutdown hours in Ocean, we must first consider if the GKE cluster has Shielded Node enabled. To check this, refer to the GKE cluster settings to determine if Shielded Nodes are enabled.

To check Shielded Node status, refer to the the GKE cluster configuration page, look under the Security group and find the key “Shielded GKE nodes”.

If the Shielded Node configuration is enabled, a workaround must be applied to ensure the Ocean controller pod can continue to run during off hours.


Implementing the Shielded Node shutdown hours workaround

To implement the workaround, consider the following:

Workaround –> Terraform a small, single zone GKE managed node pool that the ocean controller pod can run on when the Ocean managed nodes are shut down.

The following terraform code will:

  • Create a low cost, single node pool of VM type e2-small
  • Deploy the node in a single node pool in a (zonal) availability zone
  • This node pool will be managed exclusively by GKE and will remain running during shutdown hours
resource "google_container_node_pool" "shutdown_node" {
  name       = "ocean-node-for-shutdown-hours"
  location   = var.region
  node_locations = []
  cluster    =
  node_count = 1
  project    = var.project_id

  node_config {
    oauth_scopes = [

    labels = {
      env = var.project_id

    preemptible  = false
    machine_type = "e2-small"
    tags         = ["ocean--shutdown-hours-node", "${var.project_id}-gke"]
    metadata = {
      disable-legacy-endpoints = "true"

Implementing shutdown hours in terraform

Now its time to implement shutdown hours for you GKE cluster. Lucky for you, this step is nothing more than adding a single config element to your existing Ocean-GKE terraform code. In the example below you will see a new config parameter “shutdown_hours” that has been added to the configuration. In this example, we have instructed Ocean to shutdown during non-business hours. The times are defined in GMT format.

module "ocean-gcp-k8s" {
  source     = "spotinst/ocean-gcp-k8s/spotinst"

  cluster_name                      = var.cluster_name
  location                          = var.region
  shutdown_hours = {
    is_enabled = true
    time_windows = [ 

Implementing shutdown hours in the console

From within the spot console; open the Ocean cluster “Customize Scaling” settings from the “Actions” menu.


From within the scaling setting panel, ensure shut downs hours is enabled.


Now you can can click on each hour of the day in the schedule below to shutdown the instance for the given hour. The schedule below demonstrates what a cluster shutdown schedule may look like for a typical work week where applications only need to run during the business day.