Kubernetes MLflow Service Pod Connection

JMV12

I have deployed a build of mlflow to a pod in my kubernetes cluster. I'm able to port forward to the mlflow ui, and now I'm attempting to test it. To do this, I am running the following test on a jupyter notebook that is running on another pod in the same cluster.

import mlflow

print("Setting Tracking Server")
tracking_uri = "http://mlflow-tracking-server.default.svc.cluster.local:5000"

mlflow.set_tracking_uri(tracking_uri)

print("Logging Artifact")
mlflow.log_artifact('/home/test/mlflow-example-artifact.png')

print("DONE")

When I run this though, I get

ConnectionError: HTTPConnectionPool(host='mlflow-tracking-server.default.svc.cluster.local', port=5000): Max retries exceeded with url: /api/2.0/mlflow/runs/get? (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object>: Failed to establish a new connection: [Errno 111] Connection refused'))

The way I have deployed the mlflow pod is shown below in the yaml and docker:

Yaml:

---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: mlflow-tracking-server
  namespace: default
spec:
  selector:
    matchLabels:
      app: mlflow-tracking-server
  replicas: 1
  template:
    metadata:
      labels:
        app: mlflow-tracking-server
    spec:
      containers:
      - name: mlflow-tracking-server
        image: <ECR_IMAGE>
        ports:
        - containerPort: 5000
        env:
        - name: AWS_MLFLOW_BUCKET
          value: <S3_BUCKET>
        - name: AWS_ACCESS_KEY_ID
          valueFrom:
            secretKeyRef:
              name: aws-secret
              key: AWS_ACCESS_KEY_ID
        - name: AWS_SECRET_ACCESS_KEY
          valueFrom:
            secretKeyRef:
              name: aws-secret
              key: AWS_SECRET_ACCESS_KEY

---
apiVersion: v1
kind: Service
metadata:
  name: mlflow-tracking-server
  namespace: default
  labels:
    app: mlflow-tracking-server
  annotations:
    service.beta.kubernetes.io/aws-load-balancer-type: nlb
spec:
  externalTrafficPolicy: Local
  type: LoadBalancer
  selector:
    app: mlflow-tracking-server
  ports:
    - name: http
      port: 5000
      targetPort: http

While the dockerfile calls a script that executes the mlflow server command: mlflow server --default-artifact-root ${AWS_MLFLOW_BUCKET} --host 0.0.0.0 --port 5000, I cannot connect to the service I have created using that mlflow pod.

I have tried using the tracking uri http://mlflow-tracking-server.default.svc.cluster.local:5000, I've tried using the service EXTERNAL-IP:5000, but everything I tried cannot connect and log using the service. Is there anything that I have missed in deploying my mlflow server pod to my kubernetes cluster?

Paul Brit

Your mlflow-tracking-server service should have ClusterIP type, not LoadBalancer.

Both pods are inside the same Kubernetes cluster, therefore, there is no reason to use LoadBalancer Service type.

For some parts of your application (for example, frontends) you may want to expose a Service onto an external IP address, that’s outside of your cluster. Kubernetes ServiceTypes allow you to specify what kind of Service you want. The default is ClusterIP.

Type values and their behaviors are:

  • ClusterIP: Exposes the Service on a cluster-internal IP. Choosing this value makes the Service only reachable from within the cluster. This is the default ServiceType.

  • NodePort: Exposes the Service on each Node’s IP at a static port (the NodePort). A > ClusterIP Service, to which the NodePort Service routes, is automatically created. You’ll > be able to contact the NodePort Service, from outside the cluster, by requesting :.

  • LoadBalancer: Exposes the Service externally using a cloud provider’s load balancer. NodePort and ClusterIP Services, to which the external load balancer routes, are automatically created.
  • ExternalName: Maps the Service to the contents of the externalName field (e.g. foo.bar.example.com), by returning a CNAME record with its value. No proxying of any kind is set up.

kubernetes.io

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

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

編集
0

コメントを追加

0

関連記事

分類Dev

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

分類Dev

how to stop/pause a pod in kubernetes

分類Dev

Kubernetes pod auto-scaling

分類Dev

Kubernetes - Get EBS Volume of a Pod

分類Dev

Can volumeMounts: in kubernetes pod be optional

分類Dev

Running bash script in a kubernetes pod

分類Dev

Inside Service PodからKubernetesサービスに接続できませんか?

分類Dev

Pod does not communicate with other pod through service

分類Dev

Prometheus with multi-container pod on kubernetes

分類Dev

Azure Kubernetes - not able to connect pod containers

分類Dev

Save file to Kubernetes pod during deployment

分類Dev

Two containers within same pod on Kubernetes

分類Dev

Monitor custom kubernetes pod metrics using Prometheus

分類Dev

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

分類Dev

How to connect to a private IP from Kubernetes Pod

分類Dev

Not able to access Kubernetes Service

分類Dev

Internet connection from a pod inside an AKS cluster

分類Dev

Treafik UI - Kubernetes - Connection Refused

分類Dev

Kubernetes ExternalName service not visible in DNS

分類Dev

DBAL connection as service throws error

分類Dev

Kubernetes Horizontal Pod Autoscaler(HPA)テスト

分類Dev

Can I mount a GCS bucket inside Kubernetes Pod?

分類Dev

Access built-in etcd within kubernetes pod container

分類Dev

Logging to Stackdriver from Google Cloud Endpoints in Kubernetes pod

分類Dev

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

分類Dev

JobとPodのactiveDeadlineSecondsのKubernetesの違い

分類Dev

Kubernetes can telnet into POD but can't curl web content

分類Dev

Kubernetes sends traffic to the pod even after sending SIGTERM

分類Dev

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

Related 関連記事

  1. 1

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

  2. 2

    how to stop/pause a pod in kubernetes

  3. 3

    Kubernetes pod auto-scaling

  4. 4

    Kubernetes - Get EBS Volume of a Pod

  5. 5

    Can volumeMounts: in kubernetes pod be optional

  6. 6

    Running bash script in a kubernetes pod

  7. 7

    Inside Service PodからKubernetesサービスに接続できませんか?

  8. 8

    Pod does not communicate with other pod through service

  9. 9

    Prometheus with multi-container pod on kubernetes

  10. 10

    Azure Kubernetes - not able to connect pod containers

  11. 11

    Save file to Kubernetes pod during deployment

  12. 12

    Two containers within same pod on Kubernetes

  13. 13

    Monitor custom kubernetes pod metrics using Prometheus

  14. 14

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

  15. 15

    How to connect to a private IP from Kubernetes Pod

  16. 16

    Not able to access Kubernetes Service

  17. 17

    Internet connection from a pod inside an AKS cluster

  18. 18

    Treafik UI - Kubernetes - Connection Refused

  19. 19

    Kubernetes ExternalName service not visible in DNS

  20. 20

    DBAL connection as service throws error

  21. 21

    Kubernetes Horizontal Pod Autoscaler(HPA)テスト

  22. 22

    Can I mount a GCS bucket inside Kubernetes Pod?

  23. 23

    Access built-in etcd within kubernetes pod container

  24. 24

    Logging to Stackdriver from Google Cloud Endpoints in Kubernetes pod

  25. 25

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

  26. 26

    JobとPodのactiveDeadlineSecondsのKubernetesの違い

  27. 27

    Kubernetes can telnet into POD but can't curl web content

  28. 28

    Kubernetes sends traffic to the pod even after sending SIGTERM

  29. 29

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

ホットタグ

アーカイブ