How to deploy to GKE
We also deploy the same code to GKE. You can find the hands-on steps at https://github.com/wulfland/AccelerateDevOps/blob/main/ch9_release/Deploy_to_GKE.md.
Before you perform these hands-on steps, here are some details regarding what is happening.
Deployment of Google resources
The complete deployment happens in the setup-gke.sh
script that you execute in Cloud Shell. The script creates a GKE cluster with one node. For testing purposes, this is enough:
gcloud container clusters create $GKE_CLUSTER --num-nodes=1
Additionally, the script creates an artifact repository for Docker containers and a service account to perform the deployments.
In Kubernetes, there is the concept of pods. These contain the containers and are deployed using deployments in a YAML file, which, in this case, is Deployment.yaml
. The deployment defines the container and binds it to an image:
spec:
containers:
- name: $GKE_APP_NAME
...