Basic Flow:
service-definition.yml
apiVersion: v1
kind: Service
metadata:
name: myapp-service
spec:
type: NodePort
ports:
- targetPort: 80
port: 80 (container port)
nodePort: 30008 (Port of node)
selector:
app: myapp
type: front-end
kubectl create -f service-definition.yml
kubectl get services
When multiple pods are deployed on a single node, Kubernetes does a makes sure to randomly route the traffic to matching pods.
When multiple nodes exist in a cluster with this pod spun across multiple nodes, Kubernetes creates a service across nodes to ensure the nodeport routing is consistent.
No comments:
Post a Comment