Expose a Service¶
When to Use This Guide¶
Use this guide when you need to make an application accessible through a Kubernetes Service.
Services provide a stable network endpoint that allows other pods or external clients to access your application.
Service Types¶
| Type | Description | Use Case |
|---|---|---|
ClusterIP |
Internal cluster access | Communication between pods |
NodePort |
External access via node IP | Simple external exposure |
LoadBalancer |
External load balancer | Cloud environments |
Step 1 — Verify the Deployment¶
Check that your application pods are running.
Example:
Step 2 — Create the Service¶
Expose the deployment.
This creates a service that forwards traffic to the application pods.
Step 3 — Verify the Service¶
Check service status.
Example:
Step 4 — Test Internal Access¶
Test the service from another pod.
Then inside the pod:
Common Issues¶
Service Cannot Reach Pods Check service selectors.
Verify labels match pod labels.
Pods Not Ready
Services only route traffic to ready pods.
Check readiness:
Quick Workflow
kubectl get pods
kubectl expose deployment web-app --port=80 --target-port=8080
kubectl get services
Related Guides¶
Networking
- Expose Service with Ingress
- Port Forward Pod
Troubleshooting
- Debug a Crashing Pod