Pod-to-Service Networking
- Lets consider the following manifests.
- Deployment Manifest
apiVersion: apps/v1
kind: Deployment
metadata:
# Unique key of the Deployment instance
name: deployment-example
spec:
# 3 Pods should exist at all times.
replicas: 3
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
# Apply this label to pods and default
# the Deployment label selector to this value
app: nginx
spec:
containers:
- name: nginx
# Run this image
image: nginx:1.14
- Service Manifest
apiVersion: v1
kind: Service
metadata:
name: nginx-svc
spec:
selector:
app: nginx
ports:
- port: 80
targetPort: http
- The above manifests will lead to pod and service creation as shown below
- Each node will have a kube-proxy which is a key component. It’s role is to load-balance the traffic that is desired for services (via cluster ip and node ports) to the correct backend pods.
- kube-proxy can run in one of three modes
- user space
- iptables
- IPVS
- Refer Here before the next class
Topics To Revise
- DNS
- Kubernetes Controllers
- Container registries
- Micro Services
