首页 > 解决方案 > 从 Kubernetes 集群外部访问 Minio

问题描述

我使用新的操作符在 Kubernetes 上部署了 Minio:

helm repo add minio https://operator.min.io/
helm install --namespace minio-operator --create-namespace --generate-name minio/minio-operator
kubectl apply -f https://raw.githubusercontent.com/minio/operator/master/examples/tenant-tiny.yaml
sudo -E kubefwd svc
    Port-Forward: 127.1.27.1 minio:80 to pod minio-ss-0-0:9000 
    Port-Forward: 127.1.27.2 minio-hl:9000 to pod minio-ss-0-0:9000 
    Port-Forward: 127.1.27.3 minio-ss-0-0.minio-hl:9000 to pod minio-ss-0-0:9000

租户正在工作,我可以通过 minio:80 和 minio-hl:9000 访问 Web 控制台

我想从集群外部访问存储(在 Docker 上运行的 Jupyter notebook);这是我收到错误“ConnectionRefusedError: [Errno 111] Connection denied”的地方:

def main():
    client = Minio(
        "minio:80", #minio-hl:9000 leads to the same error
        access_key="minio",
        secret_key="minio123!",
        secure=False
    )

    found = client.bucket_exists("posts")
    if not found:
        client.make_bucket("posts")
        print("Bucket 'posts' created")
    else:
        print("Bucket 'posts' already exists")

我还尝试使用带有 s3a jar 的 pyspark 来读写对象,但是连接挂了很长时间,最后收到了类似的错误。

有人能帮助我吗?非常感谢!

标签: pythonkubernetesminio

解决方案


推荐阅读