Containers and Kubernetes

Get Involved. Join the Conversation.

Topic

    Joydeepta Bhattacharjee
    Pod to Pod communication with service name Should be...
    Topic posted July 20, 2019 by Joydeepta BhattacharjeeRed Ribbon: 250+ Points, last edited July 25, 2019, tagged Containers, Docker, Kubernetes, Tip 
    60 Views, 1 Comment
    Title:
    Pod to Pod communication with service name Should be followed with Ingress Resource to realise a decouple connection
    Summary:
    Instead of accessing IP which changes with deployment I would like to access pod deployment with service created which is not working in OCI OKE setup
    Content:

    kubectl describe services kube-dns --namespace kube-system

     

    Name:              kube-dns
    Namespace:         kube-system
    Labels:            addonmanager.kubernetes.io/mode=Reconcile
                       k8s-app=kube-dns
                       kubernetes.io/cluster-service=true
                       kubernetes.io/name=KubeDNS
    Annotations:       kubectl.kubernetes.io/last-applied-configuration:
                         {"apiVersion":"v1","kind":"Service","metadata":{"annotations":{},"labels":{"addonmanager.kubernetes.io/mode":"Reconcile","k8s-app":"kube-d...
    Selector:          k8s-app=kube-dns
    Type:              ClusterIP
    IP:                10.96.5.5
    Port:              dns  53/UDP
    TargetPort:        53/UDP
    Endpoints:         10.244.1.21:53,10.244.1.23:53
    Port:              dns-tcp  53/TCP
    TargetPort:        53/TCP
    Endpoints:         10.244.1.21:53,10.244.1.23:53
    Session Affinity:  None
    Events:            <none>
    [opc@test ~]$

     

    , kubectl describe svc my-api 

    [opc@test ~]$ kubectl describe svc springbootapp-demo-service
    Name:                     springbootapp-demo-service
    Namespace:                default
    Labels:                   <none>
    Annotations:              <none>
    Selector:                 app=app
    Type:                     LoadBalancer
    IP:                       10.96.157.177
    LoadBalancer Ingress:     132.145.235.116
    Port:                     <unset>  80/TCP
    TargetPort:               8035/TCP
    NodePort:                 <unset>  30963/TCP
    Endpoints:                10.244.0.26:8035,10.244.0.27:8035,10.244.0.30:8035 + 1 more...
    Session Affinity:         None
    External Traffic Policy:  Cluster
    Events:                   <none>

     

    Now  when i exec(kubectl exec -it  **Pod) to a pod and wget the other pod by FQDN it's not reached. I also connected a busy-box image to debug the kube-dns networking between pods. 

    Exec to the pod takes to prompt as  kubectl exec -it nodejs-deployment-6bffdcb99c-lf8gn sh and tried to wget below end point dummy but unreachable though IP is looked up.

     wget http://springbootapp-demo-service/demo/test
    Connecting to springbootapp-demo-service(10.96.157.177:8035)

    This has been fixed now by renaming the selector lebel in deployment yml to unique name as they are in default name space 

    Comment