Prerequisites
- A running GKE cluster
kubectlconfigured to point at your GKE cluster- An existing
gke-deployment.yamlthat successfully deploys your container

Why You Need a Service
A Kubernetes Service- Provides a stable IP or DNS name for your Pods
- Handles load balancing across Pod replicas
- Supports multiple types of exposure (ClusterIP, NodePort, LoadBalancer)
A Service decouples the network policy from your Pods. Even if your Pods get rescheduled or replaced, the Service IP/DNS remains constant.
Comparing Service Types
For GKE, LoadBalancer is the most straightforward way to get an external IP.
Updating gke-deployment.yaml
Add the following Service manifest below your existing Deployment spec in gke-deployment.yaml:
kubectl get svc my-app-service to retrieve the external IP:
http://34.68.12.34.
Provisioning a LoadBalancer can incur additional GCP costs. Be sure to delete unused Services when you’re done.