Open utterances-bot opened 3 years ago
great content mate I only wish you had posted the configuration files
Good call @romainsohnbet . I'll try and update this article shortly with a demo.
Very nicely written, so easy to understand. Thank you so much for the efforts :)
The DNS created by the service my-api
only works inside the cluster itself. In real life, however, the api calls are made outside the cluster, on the frontend application. What are the extra steps needed to establish such communication?
The article is lit 🔥. It cleared all my doubts, I had regarding communication between k8s workloads. 🎉
@shp7724 - Hi there, you can expose the pod through service of either type NodePort (pod-specific) or LoadBalancer (built on top of NodePort type) to outside of the cluster. As far as I know (currently learning K8s), when having a Microservices architecture, Ingress is typically used when communicating to the services (even if the type is ClusterIP; note that default type of service is ClusterIP) from the outside of the cluster - after creating an ingress (e.g. setting path and the port of the service), it will give us an IP to be used.
for example, we have this kind of configuration
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: minimal-ingress
annotations:
nginx.ingress.kubernetes.io/rewrite-target: /
spec:
ingressClassName: nginx-example
rules:
- http:
paths:
- path: /testpath
pathType: Prefix
backend:
service:
name: test ## name of the service
port:
number: 80 ## the port number in which the service is used
I hope this helps.
How do Pods communicate in Kubernetes?
A tutorial on how to get your application Pods in Kubernetes to talk to other Pods, by using Services.
https://www.tutorialworks.com/kubernetes-pod-communication/