简体   繁体   中英

access a external service running on a vm form inside kubernetes pod

I have a cluster in aws and using kubernetes. I have an app running on a machine (vm) in the same network as the cluster in my browser i can type http://ipaddress:port/status and i get a response

In my pod i can ping the ip address and i get a response but if i do wget://ipaddress:port/status it doesn't connect.

I have tried some things but not able to succeed. How do i get the pod in the cluster to be be able to open this url, what do I need to do?

You can integrate external services within kubernetes.

endpoint.yaml

    kind: Endpoints
    apiVersion: v1
    metadata:
      name: external-ip-database
    subsets:
      - addresses:
        - ip: 192.168.0.1
        ports:
    - port: 3306

service.yaml

    apiVersion: v1
    kind: Service
    metadata:
      name: database
    spec:
      ports:
      - port: 1433
        targetPort: 1433
        protocol: TCP
    ---
    # Because this service has no selector, the corresponding Endpoints
    # object will not be created. You can manually map the service to
    # your own specific endpoints:
    kind: Endpoints
    apiVersion: v1
    metadata:
      name: database
    subsets:
      - addresses:
          - ip: "192.168.1.103"
        ports:
          - port: 1433

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM