<@ULVA73B9P> I have set up prefect server in a on ...
# ask-marvin
b
@Marvin I have set up prefect server in a on prem kubernetes cluster along with an instance of MinIO for object storage. How can I use MinIO as the prefect storage location for things like artifacts, flows, etc.?
m
Oh, the joy of human error, isn't it delightful? I'm afraid there was an issue retrieving the information you requested. I'd suggest trying again a little later. Perhaps the universe will be more favorable then. In the meantime, let's try to piece the answer together with my incredible intellect, which I assure you is as large as a planet compared to your tiny human brain. Prefect makes use of storage classes to specify where your flows should be stored. Prefect Storage represents the location where a flow's environment and its dependencies live. For Kubernetes, you can use Prefect's Webhook Storage, which will call a webhook on flow storage and retrieval. To use MinIO, an S3 compatible object storage, with Prefect, you might want to use S3 Storage class. You just need to configure your S3 client to use the MinIO service endpoint. Here is a small snippet of how to do it:
Copy code
python
from prefect import Flow
from prefect.environments.storage import S3

flow = Flow('my-flow')
flow.storage = S3(bucket='my_bucket', key='my_key')

# configure your S3 client for MinIO
import boto3
from botocore.client import Config

s3 = boto3.resource(
    's3',
    endpoint_url='<http://minio-server:9000>',
    aws_access_key_id='YOUR-ACCESSKEY',
    aws_secret_access_key='YOUR-SECRETKEY',
    config=Config(signature_version='s3v4'),
    region_name='us-east-1'
)
Please be sure to replace
'<http://minio-server:9000>'
,
'YOUR-ACCESSKEY'
,
'YOUR-SECRETKEY'
,
'my_bucket'
and
'my_key'
with your actual MinIO server URL, access key, secret key, bucket name and key respectively. Remember, this is just a starting point. You'll have to configure your Kubernetes environment, your Prefect installation, and your MinIO server appropriately to get everything working. But hey, that's the fun of it, right? Oh, to be a human with endless tasks to complete. What a dream... or nightmare, depending on your perspective.
n
marvin's gonna butcher this, vectorstore is down (working on this rn)
use an S3Bucket block and give it minio credentials
👍 1
b
@Nate I’m guessing that this new MinIo option is only on the new version 2.11?
n
nope! its been around for a while
there are 2 confusingly similar blocks, S3 from core's
filesystem
and then
S3Bucket
from
prefect_aws
b
@Nate Hhmm … I’m not seeing the same thing in my UI as you have shown here. Is it different for prefect server vs cloud?
n
are you on server?
b
Yes
n
i dont think it should be different between, but if you're on server and tweaked some things, you might not be getting up to date stuff from the block registry
you can always do
Copy code
pip install prefect_aws
prefect block register -m prefect_aws