Skip to content

Commit

Permalink
Separate sections for scaling down the cluster and destroying it
Browse files Browse the repository at this point in the history
  • Loading branch information
kponichtera authored and JMGaljaard committed Sep 26, 2022
1 parent cb18ae3 commit c7878d0
Showing 1 changed file with 37 additions and 26 deletions.
63 changes: 37 additions & 26 deletions jupyter/terraform_notebook.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -650,19 +650,17 @@
}
},
"source": [
"# Cleaning up\n",
"\n",
"> ⚠️ THIS WILL REMOVE YOUR CLUSTER AND DATA STORED ON IT. For this tutorial's purpose destroying your cluster is not an issue. For testing/developing, we recommend manually scaling your cluster up and down instead.\n",
"\n",
"\n",
"To clean up/remove the cluster, we will use the `terraform destroy` command.\n",
"\n",
" * Running it in `terraform-dependencies` WILL REMOVE the Kubeflow Training-Operator from your cluster.\n",
" * Running it in `terraform-gke` WILL REMOVE YOU ENTIRE CLUSTER.\n",
"\n",
"You can uncomment the commands below to remove the cluster, or run the command in a terminal in the [`../terraform/terraform-gke`](../terraform/terraform-gke) directory.\n",
"# Cleaning up"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Scaling down the cluster\n",
"\n",
"> ⚠️ It is recommended to scale down the cluster/nodepools rather then destroying, refer to the last code block."
"This is the preferred way to scale down.\n",
"Scale node pools down to prevent idle resource utilization."
]
},
{
Expand All @@ -675,29 +673,42 @@
},
"outputs": [],
"source": [
"# THIS WILL REMOVE/TEARDOWN YOUR CLUSTER, ONLY RECOMMENDED FOR TESTING THE DEPLOYMENT\n",
"# terraform -chdir=$TERRAFORM_DEPENDENCIES_DIR destroy -auto-approve"
"gcloud container clusters resize $CLUSTER_NAME --node-pool $DEFAULT_POOL \\\n",
" --num-nodes 0 --region $REGION --quiet\n",
"\n",
"gcloud container clusters resize $CLUSTER_NAME --node-pool $EXPERIMENT_POOL \\\n",
" --num-nodes 0 --region $REGION --quiet"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Destroying the cluster\n",
"\n",
"> ⚠️ THIS WILL REMOVE YOUR CLUSTER AND DATA STORED ON IT. For this tutorial's purpose destroying your cluster is not an issue. For testing/developing, we recommend manually scaling your cluster up and down instead.\n",
"\n",
"To clean up/remove the cluster, we will use the `terraform destroy` command.\n",
"\n",
" * Running it in `terraform-dependencies` WILL REMOVE the Kubeflow Training-Operator from your cluster.\n",
" * Running it in `terraform-gke` WILL REMOVE YOU ENTIRE CLUSTER.\n",
"\n",
"You can uncomment the commands below to remove the cluster, or run the command in a terminal in the [`../terraform/terraform-gke`](../terraform/terraform-gke) directory.\n",
"\n",
"> ⚠️ It is recommended to scale down the cluster/nodepools rather then destroying, refer to the last code block."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"pycharm": {
"name": "#%%\n"
}
},
"metadata": {},
"outputs": [],
"source": [
"# Scale node pools down to prevent idle resource utilization.\n",
"# THIS WILL REMOVE/TEARDOWN YOUR CLUSTER, ONLY RECOMMENDED FOR TESTING THE DEPLOYMENT\n",
"\n",
"# THIS IS THE PREFERRED WAY TO SCALE DOWN\n",
"terraform -chdir=$TERRAFORM_DEPENDENCIES_DIR destroy -auto-approve -var project_id=$PROJECT_ID\n",
"\n",
"gcloud container clusters resize $CLUSTER_NAME --node-pool $DEFAULT_POOL \\\n",
" --num-nodes 0 --region $REGION --quiet\n",
"\n",
"gcloud container clusters resize $CLUSTER_NAME --node-pool $EXPERIMENT_POOL \\\n",
" --num-nodes 0 --region $REGION --quiet\n"
"terraform -chdir=$TERRAFORM_GKE_DIR destroy -auto-approve -var project_id=$PROJECT_ID"
]
}
],
Expand Down

0 comments on commit c7878d0

Please sign in to comment.