How to connect to a private IP from Kubernetes Pod

Forkmohit

I am trying to connect to a private IP from within a pod. Ping to that IP from the pod returns unreachable. However, I am able to ping that IP from the host system. What is the best way to route the traffic from the pod to the destination private IP?

Shalauddin Ahamad Shuza

Pods are not allowed to connect directly outside of kubernetes network. You can find more details here. To connect external IP you have to define Endpoints and Kubernetes will redirect request from inside pod to that IP. If you private IP need any extra task like DNS configure or anything else will is out of kubernetes. For kubernetes you will need to define Endpoints. Create you Endpoints

kind: Endpoints
apiVersion: v1
metadata:
  name: local-ip
subsets:
 - addresses:
     - ip: 10.240.0.4  # IP of your desire end point
   ports:
     - port: 27017     # Port that you want to access

Now you can connect from inside you pods using Endpoints name. But better to access Endpoints through Service. You can find more details here. You can find similar answer and flow diagram here.

この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。

侵害の場合は、連絡してください[email protected]

編集
0

コメントを追加

0

関連記事

分類Dev

How to (properly) Deploy MongoDB on Kubernetes and Access it from Another Pod/Job?

分類Dev

Azure Kubernetes - not able to connect pod containers

分類Dev

How do you get the Node IP from inside a Pod?

分類Dev

how to connect a kubernetes pod to the outside world without a forwarding rule (google container engine)

分類Dev

How to access private Docker Hub repository from Kubernetes on Vagrant

分類Dev

how to stop/pause a pod in kubernetes

分類Dev

How can I securely push from a GitLab Runner KubernetesExecutor pod to a private container registry?

分類Dev

How to Configure Pod initialization in a specific order in Kubernetes?

分類Dev

Logging to Stackdriver from Google Cloud Endpoints in Kubernetes pod

分類Dev

Copy file inside Kubernetes pod from another container

分類Dev

How to get private IP of VMSS using CLI

分類Dev

How to map one single file into kubernetes pod using hostPath?

分類Dev

in kubernetes how to print current pod rc and service configuration?

分類Dev

kubernetes POD IPはいつ変更されますか?

分類Dev

How to create connectors for Kafka-connect on Kubernetes?

分類Dev

Unable to connect to Vagrant private network from host - Destination host unreachable

分類Dev

how to connect to database service using cluster ip

分類Dev

Kubernetes pod auto-scaling

分類Dev

Kubernetes - Get EBS Volume of a Pod

分類Dev

Can volumeMounts: in kubernetes pod be optional

分類Dev

Kubernetes MLflow Service Pod Connection

分類Dev

Running bash script in a kubernetes pod

分類Dev

Get IP Address used to connect to Firebase from Android device

分類Dev

How to connect Asana from PHPStorm?

分類Dev

How to reach Kafka on private network from outside?

分類Dev

How to auto scale on Kubernetes (GKE) with a pod that runs one per node and uses all available resources?

分類Dev

How to connect to elasticsearch server using rest client with IP address

分類Dev

How to clear or clean specific pod from the local cocoapods cache

分類Dev

How to make a Pod link from a module to a script within the same distribution?

Related 関連記事

  1. 1

    How to (properly) Deploy MongoDB on Kubernetes and Access it from Another Pod/Job?

  2. 2

    Azure Kubernetes - not able to connect pod containers

  3. 3

    How do you get the Node IP from inside a Pod?

  4. 4

    how to connect a kubernetes pod to the outside world without a forwarding rule (google container engine)

  5. 5

    How to access private Docker Hub repository from Kubernetes on Vagrant

  6. 6

    how to stop/pause a pod in kubernetes

  7. 7

    How can I securely push from a GitLab Runner KubernetesExecutor pod to a private container registry?

  8. 8

    How to Configure Pod initialization in a specific order in Kubernetes?

  9. 9

    Logging to Stackdriver from Google Cloud Endpoints in Kubernetes pod

  10. 10

    Copy file inside Kubernetes pod from another container

  11. 11

    How to get private IP of VMSS using CLI

  12. 12

    How to map one single file into kubernetes pod using hostPath?

  13. 13

    in kubernetes how to print current pod rc and service configuration?

  14. 14

    kubernetes POD IPはいつ変更されますか?

  15. 15

    How to create connectors for Kafka-connect on Kubernetes?

  16. 16

    Unable to connect to Vagrant private network from host - Destination host unreachable

  17. 17

    how to connect to database service using cluster ip

  18. 18

    Kubernetes pod auto-scaling

  19. 19

    Kubernetes - Get EBS Volume of a Pod

  20. 20

    Can volumeMounts: in kubernetes pod be optional

  21. 21

    Kubernetes MLflow Service Pod Connection

  22. 22

    Running bash script in a kubernetes pod

  23. 23

    Get IP Address used to connect to Firebase from Android device

  24. 24

    How to connect Asana from PHPStorm?

  25. 25

    How to reach Kafka on private network from outside?

  26. 26

    How to auto scale on Kubernetes (GKE) with a pod that runs one per node and uses all available resources?

  27. 27

    How to connect to elasticsearch server using rest client with IP address

  28. 28

    How to clear or clean specific pod from the local cocoapods cache

  29. 29

    How to make a Pod link from a module to a script within the same distribution?

ホットタグ

アーカイブ