Managing clusters | Google Kubernetes Engine
Configuring a maintenance window
Using Console.
Open menu > Kubernetes > Clusters
Open the Clusters.
In Automation Section, Click on pencil icon of Maintenance Window.
Tick on Enable Maintenance Window. Choose the time and days for maintenance. Click Save Changes.
If you want to disable a previously created maintenance window, Untick the Enable Maintenance Window.
Using Cloud Shell
$ gcloud container clusters update <Cluster name> –maintenance-window-start 2021-05-09T06:05:00-12:00 –maintenance-window-end 2021-05-14T00:00:00-8:00 –maintenance-window-recurrence FREQ=WEEKLY –zone us-central1
This code will create a maintenance window in cluster
Removing Maintenence Window
gcloud container clusters update gke-cluster-1 –clear-maintenance-window
Cluster autoscaler
GKE‘s cluster autoscaler automatically resizes the number of nodes in a given node pool, based on the demands of your workloads. You don’t need to manually add or remove nodes or over-provision your node pools. Instead, you specify a minimum and maximum size for the node pool, and the rest is automatic.
In the Cluster, Click on Pencil icon of Autoscaling profile.
Choose Optimize utilization for cluster and click Save Changes
The following command enables optimize-utilization autoscaling profile in an existing cluster
$ gcloud beta container clusters update gke-cluster-1 –autoscaling-profile optimize-utilization
Configuring Cloud Operations for GKE
Google Kubernetes Engine (GKE) includes integration with Cloud Monitoring and Cloud Logging. This integration lets you monitor your running GKE clusters, manage your system and debug logs, and analyze your system’s performance using advanced profiling and tracing capabilities.
To enable Cloud Operations for GKE
$ gcloud container clusters update gke-cluster-1 –zone=us-central1 –enable-stackdriver-kubernetes
To enable Legacy Logging and Monitoring
$ gcloud container clusters update gke-cluster-1 –zone=us-central1 –logging-service logging.googleapis.com –monitoring-service monitoring.googleapis.com
To remove Cloud Operations for GKE or Legacy Logging and Monitoring,
$ gcloud container clusters update gke-cluster-1 –zone=us-central1 –no-enable-stackdriver-kubernetes
Enabling auto-repair for an existing node pool
$ gcloud container node-pools update default-pool –cluster gke-cluster-1 –zone us-central1-c –enable-autorepair
Disable auto-repair for an existing node pool
$ gcloud container node-pools update default-pool –cluster gke-cluster-1 –zone us-central1-c –no-enable-autorepair
Sometimes this error may arise. To rectify that, In Cluster basics, Click on pencil icon of Release channel.
Change Release channel to static version. And click Save Changes. Then try again.
Using Cloud Console.
In cluster, Click on Nodes.
Open the node pool which you created.
Click on Edit.
Tick the Enable Auto Repair and Click Save.
Managing clusters | Google Kubernetes Engine