This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gcloud container clusters upgrade $CLUSTER_NAME \ | |
--region $GCP_REGION \ | |
--cluster-version $NEW_K8S_VER \ | |
--project $PROJECT_ID \ | |
--master |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NODE=$(kubectl get nodes -o wide | grep v1.22.12-gke.2300 | awk '{print $1}' | |
kubectl -n default cordon $NODE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gcloud container node-pools delete default-pool \ | |
--project $PROJECT_ID \ | |
--cluster $CLUSTER_NAME \ | |
--region $GCP_REGION |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gcloud container node-pools create pool-gke1-23 \ | |
--project $PROJECT_ID \ | |
--cluster $CLUSTER_NAME \ | |
--region $GCP_REGION \ | |
--num-nodes $NUM_NODES \ | |
--machine-type $MACHINE_TYPE \ | |
--node-labels=nodepool=$NEW_GKE_VER |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Define env variables | |
export PROJECT_ID=$(gcloud config get-value project) | |
export PROJECT_USER=$(gcloud config get-value core/account) | |
export PROJECT_NUMBER=$(gcloud projects describe $PROJECT_ID --format="value(projectNumber)") | |
export IDNS=${PROJECT_ID}.svc.id.goog | |
export GCP_REGION="us-central1" | |
export GCP_ZONE="us-central1-c" | |
export NETWORK_NAME="default" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gcloud config set compute/region $GCP_REGION | |
gcloud config set compute/zone $GCP_ZONE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gcloud services enable compute.googleapis.com \ | |
container.googleapis.com \ | |
storage.googleapis.com \ | |
gkebackup.googleapis.com |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export CLUSTER_NAME="gke-central1-a" | |
gcloud beta container clusters create $CLUSTER_NAME \ | |
--project=$PROJECT_ID \ | |
--region=$LOCATION \ | |
--addons=BackupRestore \ | |
--num-nodes=1 \ | |
--enable-autoupgrade --no-enable-basic-auth \ | |
--no-issue-client-certificate --enable-ip-alias \ | |
--metadata disable-legacy-endpoints=true \ | |
--workload-pool=$IDNS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# create Kustomize file | |
cat > ./kustomization.yaml << EOF | |
secretGenerator: | |
- name: mysql-pass | |
literals: | |
- password=gkebackup2022 | |
EOF | |
# download manifests | |
curl -LO https://k8s.io/examples/application/wordpress/mysql-deployment.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gcloud alpha container backup-restore backup-plans create $BACKUP_PLAN \ | |
--project=$PROJECT_ID \ | |
--location=$LOCATION \ | |
--cluster=$CLUSTER \ | |
--all-namespaces \ | |
--include-secrets \ | |
--include-volume-data \ | |
--cron-schedule="0 * * * *" \ | |
--backup-retain-days=$RETAIN_DAYS \ | |
--locked |