Pod unable to communicate with out of cluster

adm-TAMEYYAR 0 Reputation points
2024-01-31T05:39:13.56+00:00

We have created a cluster with kubenet network. Pod is not able to communicate with out side of cluster resource like Kafka. We have opened enough firewall and configured routable for aks VNET and kafka Vnet. We tested the connectivity using telnet from one of VMSS to Kafka server, its working.

Azure Kubernetes Service (AKS)
Azure Kubernetes Service (AKS)
An Azure service that provides serverless Kubernetes, an integrated continuous integration and continuous delivery experience, and enterprise-grade security and governance.
1,999 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Andriy Bilous 11,176 Reputation points MVP
    2024-01-31T21:40:32.1166667+00:00

    Hello adm-TAMEYYAR Best practices says that if you would like to connect external services like DBs, Queues, etc you need to use Endpoints and Services.
    This way the connectivity is being managed by Kubernetes. Here is an example:

        ---
        kind: "Service"
        apiVersion: "v1"
        metadata:
          name: "kafka"
        spec:
          ports:
            -
              name: "kafka"
              protocol: "TCP"
              port: 9092
              targetPort: 9092
              nodePort: 0
        ---
        kind: "Endpoints"
        apiVersion: "v1"
        metadata:
          name: "kafka"
        subsets:
          -
            addresses:
              -
                ip: "10.128.0.2"
            ports:
              -
                port: 9092
                name: "kafka"
    
    

    https://stackoverflow.com/questions/50595162/kubernetes-node-cant-reach-external-kafka-cluster