Evolution of application deployment over the past 20 years.
Configure your local and remote lab environments.
Covers the resource types that are included with Kubernetes.
•Pod
•Job
Using helm to manage Kubernetes resources
Example microservice application.
Kubernetes manifests to deploy the demo application.
Explore how custom resources can add functionality
Install additional software to enhance the deployment.
Improving the DevX when working with Kubernetes.
How to safely upgrade your clusters and nodes.
Implement CI/CD for your applications (with GitOps!)
In this section, you will set up a Kubernetes cluster using Google Cloud Platform (GCP).
Before creating the cluster, you need to authenticate and configure the GCP CLI. Follow these steps to initialize the gcloud CLI.
# task gcp:01-init-cli
# - Authenticate and configure the gcloud CLI.
gcloud init
GCP does not enable many of its APIs by default. In order to use the various services required, we must first enable those APIs.
# task gcp:02-enable-apis
# - Enable necessary APIs
gcloud services enable \
compute.googleapis.com \
container.googleapis.com \
cloudresourcemanager.googleapis.com \
iam.googleapis.com \
secretmanager.googleapis.com \
servicemanagement.googleapis.com \
serviceusage.googleapis.com
We then need to set the default region and zone to avoid needing to pass them into each command.
# task gcp:03-set-region-and-zone
# - Set default region and zone
gcloud config set compute/region ${GCP_REGION}
gcloud config set compute/zone ${GCP_ZONE}
Again, we could deploy a cluster into the default Virtual Private Cloud (VPC) but it is better practice to avoid using the default VPC and create a new one.
# task gcp:04-create-vpc
# - Create VPC.
gcloud compute networks create ${CLUSTER_NAME} --subnet-mode=custom
Before we can deploy compute resources into the VPC, we must create a subnet.
# task gcp:05-create-subnet
# - Create subnet
gcloud compute networks subnets create subnet-1 \
--network=${CLUSTER_NAME} \
--region=${GCP_REGION} \
--range=10.0.0.0/20
With the network and subnet created, you can now create the GKE cluster. This will take a few minutes.
🚨 Note: You will need to look up GCP project ID to use in the --workload-pool
option. This will allow us to use the GKE Workload Identity feature to authenticate to other GCP services dynamically.
# task gcp:06-create-cluster
# - Create GKE cluster
gcloud container clusters create ${CLUSTER_NAME} \
--zone ${GCP_ZONE} \
--network ${CLUSTER_NAME} \
--subnetwork subnet-1 \
--machine-type e2-standard-2 \
--num-nodes 2 \
--gateway-api=standard \
--workload-pool={{.GCP_PROJECT_ID}}.svc.id.goog
After the cluster finishes creating, you can retrieve the kubeconfig file for your cluster to connect with kubectl.
# task gcp:08-connect-to-cluster
# - Connect to the GKE cluster
gcloud container clusters get-credentials ${CLUSTER_NAME} --zone ${GCP_ZONE}
You should now have a fully functioning GCP Kubernetes cluster. Verify by running:
kubectl get nodes
After completing your work with the cluster, you can clean up by deleting the cluster and associated resources.
# task gcp:09-clean-up
# - Clean up the GCP Kubernetes cluster and associated resources.
gcloud container clusters delete ${CLUSTER_NAME} --zone ${GCP_ZONE} --quiet
gcloud compute networks subnets delete subnet-1 --region=${GCP_REGION} --quiet
gcloud compute networks delete ${CLUSTER_NAME} --quiet