Domantas
05/18/2021, 12:32 PMjob_template_path
parameter in KubernetesRun
by passing yaml file which looks like this:
apiVersion: batch/v1
kind: Job
metadata:
name: prefect-job
labels: {}
spec:
template:
metadata:
labels: {}
spec:
containers:
- name: flow
image: test-image:1.2
imagePullPolicy: IfNotPresent
command: ["/bin/sh", "-c"]
args: ["prefect execute flow-run"]
env:
- name: PREFECT__CONTEXT__SECRETS__database_psw
value: veryStrongPasswrod
volumeMounts:
- name: storage
mountPath: /tnt/test/domantas_test
restartPolicy: Never
imagePullSecrets:
- name: registry-secret
volumes:
- name: storage
cephfs:
monitors:
- 59.11.129.131
- 59.11.129.132
- 59.11.129.133
- 59.11.129.134
- 59.11.129.135
path: /test
user: storage
secretRef:
name: ceph-secret
However, when I try to execute in prefect server UI, it seems the flow get stuck with "Submitted for execution" status with no useful logs.
I took job_template example from here: https://github.com/PrefectHQ/prefect/blob/master/src/prefect/agent/kubernetes/job_spec.yaml and additionally added cephFS necessary parameters.Kevin Kho
Kevin Kho
Kevin Kho
Domantas
05/18/2021, 2:18 PMKevin Kho
Kevin Kho
Domantas
05/18/2021, 2:26 PMflow.run_config = KubernetesRun(
cpu_request=2,
memory_request="2Gi",
image="test-image:1.2",
image_pull_secrets=["registry-secret"],
job_template_path="/home/Projects/prefect/job_template.yaml",
)
Maybe this is the root of the problem that agent is unable to pick latest job template when kubernete container is created?
Just for testing, I uploaded job_template.yaml file into s3 storage, and trying to fetch it from there. However, prefect throws an error: Unable to locate credentials
.
If this is the root of the issue, how to pass aws credentials into KubernetesRun? (I checked https://docs.prefect.io/api/latest/run_configs.html#kubernetesrun and could not find any example of how to to that)Kevin Kho
env
keyword. Here is the format for aws credentialsKevin Kho
Domantas
05/18/2021, 2:46 PMflow.run_config = KubernetesRun(
cpu_request=2,
memory_request="2Gi",
image="test-image:1.2",
image_pull_secrets=["registry-secret"],
job_template_path="<s3://prefect/job_template.yaml>",
env={
"PREFECT__CONTEXT__SECRETS__AWS_CREDENTIALS": {"ACCESS_KEY": aws_access_key_id, "SECRET_ACCESS_KEY": aws_secret_access_key}
}
)
I still get an error:
botocore.exceptions.NoCredentialsError: Unable to locate credentials
Default aws credentials are properly declared in ~/.aws/credentials
file
Also I'm using S3Result method, so there I setup credentials through client_options
parameters which seems to work properly.Kevin Kho
Kevin Kho
Domantas
05/19/2021, 9:24 AM--show-flow-logs
on Kubernete agent
? The only available option related with this answer is setting debug log level(https://docs.prefect.io/api/latest/cli/agent.html#kubernetes-start).
However, setting debug log option is still not enough, because there are no logs why do code state get stuck into Submitted
state(https://docs.prefect.io/orchestration/faq/debug.html#my-flow-is-stuck-in-a-submitted-state).Domantas
05/19/2021, 10:46 AMjob_template yaml file
into the KuberneteRun, so I think something is wrong with the content of that yaml file. The bad thing, that I'm still not able to detect from the logs which part of yaml configuration is causing me troubles 🤔Kevin Kho
Domantas
05/27/2021, 6:46 AM