GKE Starter | Study Session 1
Based on: https://cloud.google.com/kubernetes-engine/docs/deploy-app-cluster
Sample interaction to get started in Cloud Shell or local (after installing Gcloud - in Ubuntu just download and run install.sh, as of dec-30-2022).
Session 1 - Getting started
Welcome to Cloud Shell! Type "help" to get started.
Your Cloud Platform project in this session is set to cloudworks22.
Use “gcloud config set project [PROJECT_ID]” to change to a different project.
krexspace@cloudshell:~ (cloudworks22)$ ls
README-cloudshell.txt
krexspace@cloudshell:~ (cloudworks22)$ gcloud config list
[accessibility]
screen_reader = True
[component_manager]
disable_update_check = True
[compute]
gce_metadata_read_timeout_sec = 30
[core]
account = krexspace@gmail.com
disable_usage_reporting = True
project = cloudworks22
[metrics]
environment = devshell
Your active configuration is: [cloudshell-1548]
krexspace@cloudshell:~ (cloudworks22)$ kubectl get pods
The connection to the server localhost:8080 was refused - did you specify the right host or port?
krexspace@cloudshell:~ (cloudworks22)$ gcloud container clusters get-credentials hello-cluster \
--region us-west1
Fetching cluster endpoint and auth data.
kubeconfig entry generated for hello-cluster.
krexspace@cloudshell:~ (cloudworks22)$ kubectl get pods
NAME READY STATUS RESTARTS AGE
hello-server-7cc77d5467-ggk89 1/1 Running 0 70m
krexspace@cloudshell:~ (cloudworks22)$ kubectl get service
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
hello-server LoadBalancer 10.104.1.231 104.196.233.141 80:30401/TCP 69m
kubernetes ClusterIP 10.104.0.1 <none> 443/TCP 90m
krexspace@cloudshell:~ (cloudworks22)$ kubectl get service hello-server
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
hello-server LoadBalancer 10.104.1.231 104.196.233.141 80:30401/TCP 69m
krexspace@cloudshell:~ (cloudworks22)$ ^C
krexspace@cloudshell:~ (cloudworks22)$ kubectl create deployment reactauth01 \
--image=us-west1-docker.pkg.dev/cloudworks22/art-reg-windycreek/react-auth0-sampler01:tag1
Warning: Autopilot set default resource requests for Deployment default/reactauth01, as resource requests were not specified. See http://g.co/gke/autopilot-defaults
deployment.apps/reactauth01 created
krexspace@cloudshell:~ (cloudworks22)$ kubectl get service
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
hello-server LoadBalancer 10.104.1.231 104.196.233.141 80:30401/TCP 74m
kubernetes ClusterIP 10.104.0.1 <none> 443/TCP 94m
krexspace@cloudshell:~ (cloudworks22)$ kubectl get pods
NAME READY STATUS RESTARTS AGE
hello-server-7cc77d5467-ggk89 1/1 Running 0 74m
reactauth01-6fc4dcd8cd-kj9ql 0/1 Pending 0 24s
kubectl expose deployment reactauth01 --type LoadBalancer --port 80 --target-port 3000
Session 2 - Deploy an app to a GKE Cluster with Domain Mapping from AWS
Based on: https://cloud.google.com/kubernetes-engine/docs/deploy-app-cluster
gcloud config list
export PID=$(gcloud config get-value project)
export REG=us-west1
For domain mapping add the RECS in AWS Hosted Sites under Route 59, as per cloud run docs (easy setup).