Services Flashcards
What is a service in kubernetes ?
Service is nothing but the Networking layer by which we can access one or more PODS.
Can we rely on IP address of a POD to communicate with same ?
No.
If a POD is replaced, its IP address also gets changed.
How should we access a POD, if it’s IP address keeps changing ?
using “Service”.
Can we find out the IP address of a POD before it’s scheduling ?
No.
IP address is always allocated to the POD, once it gets scheduled. Hence, we cannot share same before it’s scheduling.
What are the roles of a Service in Kubernetes ?
- Accept the request from external user and pass same to one of POD
- Load balance the request
How a Service knows to which POD it needs to pass the request ?
Using Labels.
Both POD and Service must be using the “same” label to bound themselves. The label is the only way by which a Service load balances the requests between PODs.
Does IP address of a service keeps changing ?
No, it remains fixed.
On which Networking layer, does Service object works ?
Layer 4 (TCP/UDP over IP)
How a frontend POD can communicate with Backend POD ?
The Frontend POD can call the IP address of Service which abstracts the accessiblity of Backend PODs.
What are the different types of Services available in Kubernetes ?
- ClusterIP service
- NodePort Service
- LoadBalancer Service
- ExternalName service
Can we access the “clusterIP” service from outside the K8 cluster ?
No.
ClusterIP service can only be accessed within the K8 cluster.
What’s a clusterIP service ?
ClusterIP services is a K8 service which exposes the PODs within the cluster IPs.
How a POD belongs to one service can access another POD belongs to another service ?
Using “Cluster IP” service.
What’s a Node Port Service ?
NodePort Service is a K8 Service which exposes the PODs on Node’s IP address at a static port.
Can we access a POD using NodePort service ?
Yes.
It provides access to POD via Node’ IP and static port