tutorialworks / comments

Comments on our articles
https://www.tutorialworks.com
4 stars 1 forks source link

kubernetes-pod-communication/ #16

Open utterances-bot opened 3 years ago

utterances-bot commented 3 years ago

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/

romainsohnbet commented 3 years ago

great content mate I only wish you had posted the configuration files

monodot commented 2 years ago

Good call @romainsohnbet . I'll try and update this article shortly with a demo.

ntnvi10 commented 2 years ago

Very nicely written, so easy to understand. Thank you so much for the efforts :)

shp7724 commented 2 years ago

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?

Sj1218305 commented 2 years ago

The article is lit 🔥. It cleared all my doubts, I had regarding communication between k8s workloads. 🎉

juddbaguio commented 2 years ago

@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.