What is a Pod?
Smallest deployable unit in Kubernetes.
A Pod contains:
Pod
├── Application Container
└── Optional Sidecar Container
Example: nginx Pod
apiVersion: v1
kind: Pod
metadata:
name: nginx
spec:
containers:
- name: nginx
image: nginx
Problem with Pods
Pod IP changes after restart.
Example: Pod IP = 10.10.1.20
Pod dies:
New Pod IP = 10.10.1.30
Clients break.
Kubernetes Service
Provides a stable endpoint.
Client
|
Service
|
-----------
| | |
P1 P2 P3
Service never changes.
Pods can change.
Service Types
ClusterIP (Default)
Internal communication.
Example: Frontend ---> Backend
Inside cluster only.
NodePort
Exposes application on worker node port.
Example: 192.168.1.10:30080
External users can access.
LoadBalancer
Cloud environments: AWS/Azure/GCP
Internet
|
Load Balancer
|
Service
|
Pods
Most commonly used in production.
ExternalName
Maps service to external DNS.
Example: externalName: database.company.com
No comments:
Post a Comment
testing