# GKE Cloud Onboard
- Declaritive configuration
- Config as Code, IAC
- You manage infra config, GKE handles how to achieve
- Master Components
# Pod
One pod share IP
- use localhost to talk to each other inside pod
pod yaml file
pod
VSdocker compose
# Volume
- Share and restore data.
# Networking between pods
- GKE uses iptable
# Cluster Overview
# controllers
# apiserver
# etcd
# scheduler
# pod -> provide storage and network
# who decides where to run pods?
- scheduler
# GKE Security
# UserAccount
- cannot user kubectl
# ServiceAccount
- only k8s entities
# Default needs to tune
#
- Security
- project
- applicaton
- cluster
#
- export ${PROJECT_ID}
- docker build and just push to gcr
# Steps:
- enable registry api:
gcloud service enable containerregistry.googleapi.com
1
- authorize docker
gcloud auth configure-docker
1
- push
docker push gcr.io/${PROJECT_ID}/hello-app:v1
1
# Spinup GKE
- init k8s cluster
gcloud container clusters create cliuster-1 --num-nodes 3
1
- create deployment
kubectl create deployment hello-app --image=gcr.io/${project_ID}/hello-app/v1
1
- expose deployment
kubectl expose deployment hello-app --name hello-app-service --type=LocaBalancer --port 80 --target-port 8080
1
- list all service
kubectl get service
1
- list all pods
kubectl get pods
1
- scale
kubectl scale deployment ${deployment-name} --replica=3
1
- set auto-scale
kubectl autoscale deployment helo-app --cpu-precent=80 --min=1 --max=5
1
# Anthos
# Knative
- build/run/deploy serverless
- cloud run for anthos
# Comparison
- convert docker-compose to gke https://kubernetes.io/docs/tasks/configure-pod-container/translate-compose-kubernetes/