Thomas Weatherston
08/13/2021, 2:21 PMClientError('An error occurred (AccessDenied) when calling the PutObject operation: Access Denied')
Thomas Weatherston
08/13/2021, 2:22 PMBilly McMonagle
08/13/2021, 2:23 PMBilly McMonagle
08/13/2021, 2:23 PMThomas Weatherston
08/13/2021, 2:23 PMflow.storage = Docker(
registry_url="",
image_name="",
base_image="",
local_image=True,
)
flow.executor = LocalExecutor()
flow.run_config = KubernetesRun()
flow.register(project_name="example-project")
Thomas Weatherston
08/13/2021, 2:25 PMBilly McMonagle
08/13/2021, 2:25 PMLocalExecutor
at all) ... but you're going to need to attach some IAM permissions to your kubernetes container.Billy McMonagle
08/13/2021, 2:26 PMKubernetesRun
objectSam Luen-English
08/13/2021, 2:37 PMBilly McMonagle
08/13/2021, 2:39 PMSam Luen-English
08/13/2021, 2:49 PMSam Luen-English
08/13/2021, 2:50 PMBilly McMonagle
08/13/2021, 2:52 PMBilly McMonagle
08/13/2021, 2:53 PMBilly McMonagle
08/13/2021, 2:54 PMThomas Weatherston
08/13/2021, 2:56 PMBilly McMonagle
08/13/2021, 2:56 PMSam Luen-English
08/13/2021, 2:57 PMKevin Kho
flow.run()
or are you registering and running it?Kevin Kho
Sam Luen-English
08/13/2021, 3:48 PMimport os
import sys
import prefect
from prefect.engine.results import S3Result
from prefect import task, Flow
from prefect.run_configs import KubernetesRun, LocalRun
from prefect.storage import Docker
s3_result = S3Result(bucket=os.environ["bucket_name"])
@task(log_stdout=True, result=s3_result)
def example_task():
print(prefect.context.get("secrets"))
return "test"
with Flow("My First Flow", result=s3_result) as flow:
example_task()
def register():
flow.storage = Docker(
registry_url=os.environ["docker_repo"],
image_name="prefect-result-test",
)
flow.run_config = KubernetesRun()
flow.register(project_name=os.environ["project_name"])
def run():
flow.run_config = LocalRun()
flow.run()
if __name__ == "__main__":
{"register": register, "run": run}[sys.argv[1]]()
Locally, all works as expected.
When I register it in PrefectCloud and run in kubernetes, it does not work.
Thanks for looking into this 👍Kevin Kho
Sam Luen-English
08/13/2021, 3:51 PMSam Luen-English
08/13/2021, 3:51 PMKevin Kho
PREFECT__CLOUD__USE_LOCAL_SECRETS
set to true? Maybe you can explicitly make this False?Sam Luen-English
08/13/2021, 4:05 PMSam Luen-English
08/13/2021, 4:05 PMSecret("AWS_CREDENTIALS").get()
Sam Luen-English
08/13/2021, 4:05 PMSam Luen-English
08/13/2021, 4:06 PMBilly McMonagle
08/13/2021, 4:14 PMSecret("AWS_CREDENTIALS").get()
, you are getting the secret, but you are not adding it to the context. Therefore it is unavailable when the S3Result
is trying to pull it.Kevin Kho
Sam Luen-English
08/13/2021, 4:21 PMBilly McMonagle
08/13/2021, 4:28 PMKevin Kho
Sam Luen-English
08/13/2021, 9:18 PM