Google Kubernetes Engine (GKE): Clusters, Autopilot vs Standard, Workloads, Services, Autoscaling and Security
Containers and Kubernetes in Brief
- A container packages an app with its dependencies so it runs the same everywhere
- Kubernetes (K8s) runs many containers across many machines: it schedules, scales, heals and updates them
- Google created Kubernetes, and GKE is the managed version
| K8s term | Meaning |
|---|---|
| Pod | Smallest unit: one or more containers |
| Deployment | Keeps N copies of a pod running and handles updates |
| Service | Stable address that load-balances to pods |
| Ingress / Gateway | HTTP(S) entry from the internet |
| ConfigMap / Secret | Settings and sensitive values |
| Namespace | Logical separation inside a cluster |
| Node | A VM that runs pods. Nodes are grouped in node pools |
Autopilot vs Standard
| Autopilot | Standard | |
|---|---|---|
| Who manages nodes | Google (fully managed) | You (choose machine types, pools) |
| Billing | Per pod resources requested | Per node VM |
| Security defaults | Hardened by default | You configure |
| Flexibility | Some limits on privileged workloads | Full control (GPUs, custom kernels, special setups) |
| Best for | Most teams, less operations | Special needs, tight cost tuning |
Default advice Start with Autopilot unless you need node-level control.
Create a Cluster
bash
gcloud services enable container.googleapis.com
gcloud container clusters create-auto shop-cluster --region=asia-south1
gcloud container clusters get-credentials shop-cluster --region=asia-south1
kubectl get nodes
- Regional clusters spread the control plane and nodes over three zones (high availability)
- Private clusters give nodes only private IPs. Use authorized networks to restrict the API endpoint
- Release channels (Rapid, Regular, Stable) control automatic upgrades
Deploy an App
yaml
apiVersion: apps/v1
kind: Deployment
metadata: {name: web}
spec:
replicas: 3
selector: {matchLabels: {app: web}}
template:
metadata: {labels: {app: web}}
spec:
containers:
- name: web
image: us-docker.pkg.dev/google-samples/containers/gke/hello-app:1.0
ports: [{containerPort: 8080}]
resources: {requests: {cpu: 250m, memory: 256Mi}}
readinessProbe: {httpGet: {path: /, port: 8080}}
---
apiVersion: v1
kind: Service
metadata: {name: web}
spec:
type: LoadBalancer
selector: {app: web}
ports: [{port: 80, targetPort: 8080}]
bash
kubectl apply -f web.yaml
kubectl get pods,svc
kubectl set image deployment/web web=us-docker.pkg.dev/google-samples/containers/gke/hello-app:2.0 # rolling update
kubectl rollout status deployment/web
kubectl rollout undo deployment/web
Scaling
| Type | What it scales |
|---|---|
| Horizontal Pod Autoscaler (HPA) | Number of pods by CPU or custom metrics |
| Vertical Pod Autoscaler (VPA) | Pod CPU and memory requests |
| Cluster autoscaler / node auto-provisioning | Number and type of nodes (Standard). Autopilot does this for you |
bash
kubectl autoscale deployment web --cpu-percent=60 --min=3 --max=20
Exposing Apps
Service type LoadBalancer: a Layer 4 load balancer- Ingress or Gateway API: Google Cloud Application Load Balancer with paths, hosts, TLS and Cloud Armor
- Network Endpoint Groups send traffic straight to pods
Security
- Workload Identity Federation for GKE: pods act as a Google service account without keys
- Network policies control pod-to-pod traffic
- Binary Authorization and Artifact Analysis for trusted images
- Shielded GKE nodes, private nodes, minimal RBAC, Secret Manager integration
When to Choose GKE
| Pick | When |
|---|---|
| GKE | Many microservices, Kubernetes skills, portability, complex networking or stateful containers |
| Cloud Run | Simple stateless containers with scale to zero and no cluster management |
| Compute Engine | Need full VM control |
Practice
- Create an Autopilot cluster and deploy the sample app
- Scale it with HPA and watch pods increase
- Roll out a new version, then roll it back
- Expose the app through a LoadBalancer service
- Delete the cluster
Conclusion
GKE runs containers at scale. Autopilot is the easy default, Standard gives control. Use regional clusters, HPA, Workload Identity and release channels, and choose Cloud Run when you do not need Kubernetes.
Quick Summary: basics; Autopilot vs Standard; create; deploy; scaling; exposing; security; choosing.

