I need to connect between pod-1 and pod-2 in the same namespace. I want to test mutlicast using netcat
.
I tried to listen on one pod and connect to that from the other pod using the pod-1 IP but that doesn't work. I even tried tomcat7.test-web-dev and that doesn't work either. Ping doesn't respond either.
apiVersion: v1
kind: Service
metadata:
name: tomcat7
namespace: test-web-dev
spec:
selector:
app: tomcat7 # Metadata label of the deployemnt pod template or pod metadata label
ports:
- name: port-1234
protocol: TCP
port: 1234
targetPort: 1234
- name: port-1234
protocol: UDP
port: 1234
targetPort: 1234
<service-name>.<namespace>.svc.cluster.local
or <service-name>.<namespace>
works as well.
try connecting to:
<clusterip>.<namespace>.pod.cluster.local
or
<clusterip>.<namespace>.svc.cluster.local
but yes, in general, it is a pain to setup these things depending on your k8s deployment.
You can also enter the client pod using kubectl and try pinging the server one on different addresses until success.
kubectl exec --stdin --tty <client-pod-name> -- /bin/bash