Services
Services
Services enables communication between various components within and outside of the application.
Service types
NodePort
Where the service makes an internal POD accessible on a POD on the NODE. Where the service makes an internal POD accessible on a POD on the NODE.
else we can access it like ip:port
kubectl create -f service-definition.yaml
kubectl get services
CluserIP
in nodes if there is multiple applications like fronted backend , db they need to communicate to each other. but communicate with ip is not opation they will change CluserIP gives ability to group this pods under one name and give other pods to access with name.
kubectl get services
LoadBalacer
we can instlal load balancer like HA or nginx and add node ports . we can user native cloud balancer useing LoadBalacer service.
create sample yaml file
kubectl run redis --image=redis:alpine --dry-run=client -o yaml > redis.yaml
create service from command line
kubectl expose pod redis --name redis-service --port=3839