You are viewing a free preview of this lesson.
Subscribe to unlock all 10 lessons in this course and every other course on LearningBro.
Networking is one of the most complex aspects of Kubernetes. This lesson covers Service types, Ingress controllers, NetworkPolicies, DNS, and service discovery — the building blocks for production-grade connectivity.
A Service provides a stable endpoint for a set of pods, abstracting away pod IP changes.
| Type | Accessibility | Use Case |
|---|---|---|
| ClusterIP | Within the cluster only | Internal microservice communication |
| NodePort | External via node IP:port | Development, testing |
| LoadBalancer | External via cloud LB | Production external traffic |
| ExternalName | DNS CNAME redirect | Accessing external services |
apiVersion: v1
kind: Service
metadata:
name: backend-api
spec:
type: ClusterIP
selector:
app: backend-api
ports:
- port: 80
targetPort: 8080
protocol: TCP
apiVersion: v1
kind: Service
metadata:
name: web-app
spec:
type: NodePort
selector:
app: web-app
ports:
- port: 80
targetPort: 8080
nodePort: 30080 # Accessible on every node at port 30080
apiVersion: v1
kind: Service
metadata:
name: public-api
annotations:
service.beta.kubernetes.io/aws-load-balancer-type: nlb
spec:
type: LoadBalancer
selector:
app: public-api
ports:
- port: 443
targetPort: 8443
Subscribe to continue reading
Get full access to this lesson and all 10 lessons in this course.