K8s services

  • Notify customers if the count of agents in the contact center changes.
  • Notify customers (which you probably even don’t know) if the contact number to the agents has changed.
  • The distribution of the inbound calls across the agents is unequal.
  • Think about the user experience in the worst case where all agents are already on a call with other customers.

Problems without K8s service

  • Pods can go down and come up anytime due to various reasons eg. scale-up pods, cluster node crash, an issue with kubelet, etc.
  • Pod IP can be known only after the pod has been started on the node.
  • The client has to take responsibility for the distribution of traffic across multiple pods.

K8s service

apiVersion: v1
kind: Service
metadata:
name: first-service
spec:
ports:
- port: 80
targetPort: 8080
selector:
app: first-app
  • Service name is first-service
  • It accepts requests on port 80
  • Service redirect the traffic to the pod at port 8080
  • Service find the pods with label app: first-app
kubectl apply -f service1.yaml
kubectl get svc
kubectl describe svc first-service
spec:
sessionAffinity: ClientIP

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Ajay Yadav

Ajay Yadav

Believer of Distributed Systems