I have a set of pods in a deployment, and I'd like to have a pod in the same namespace be able to connect to one of the specific pods in the deployment. For instance, I'd like the ability to connect directly to an exposed port on pod my-pod-55785865c5-cjxfs
. Is this possible?
You can create the service and use it as the method to create connection. Kubernetes services : https://kubernetes.io/docs/concepts/services-networking/service/
Pod to Pod communication: pod-ip.namespace.pod
Service to service communication : service-name.my-namespace.svc.cluster.local
However you can also use pod IP clusterIP to make connections but with a pod restart the IP changes.
You can use the pod IP to connect to it. However the pod IPs are ephemeral. As soon as the pod dies and comes back up, the IP changes. Keep that in mind.
Pod to pod communication: pod-ip.namespace.pod
but still the IPs are ephemeral.