Hi ! , Is there anyone successfully submitted a fl...
# ask-community
t
Hi ! , Is there anyone successfully submitted a flow in Openshift ? I was getting the prefect agent up and running in the cluster and try to execute the flow in it, but the state got stuck into 'Submitted for execution'. The debug log in agent didn't help much.
Copy code
DEBUG:agent:Querying for ready flow runs...
[xx] DEBUG - agent | Creating namespaced job prefect-job-c4a440b5
DEBUG:agent:Creating namespaced job prefect-job-c4a440b5
[xx] DEBUG - agent | Job prefect-job-c4a440b5 created
DEBUG:agent:Job prefect-job-c4a440b5 created
[xx] INFO - agent | Completed deployment of flow run 549ced42-7840-43d6-89da-6f1a1f9cb378
INFO:agent:Completed deployment of flow run 549ced42-7840-43d6-89da-6f1a1f9cb378
k
Hey @Terawat T, I have no experience with OpenShift. I think being stuck like this though is normally a sign of permission issues for the Flow could not be downloaded (where is the image being downloaded from?)
t
@Kevin Kho Thanks for prompt response, I dig down to the moment that the job was created, and finally got more hint on the image pull secrets (The image stored in private registry). The submitted job yaml in Openshift got translate to this:-
Copy code
imagePullSecrets:
    - name: a
    - name: b
    - name: c
    - name: '-'
    - name: d
    - name: e
    - name: f
The job template configured in memory is like this, trying with several option but no luck so far.
Copy code
job_template="""
    apiVersion: batch/v1
    kind: Job
    spec:
      template:
        spec:
          imagePullSecrets:
            - name: "abc-def"
          containers:
            - name: flow
          nodeSelector:
            nodegroup: xxxx
    """
Finally got it, just realize that the job template must be configured via the KubernetesRun with an array of string....
Copy code
flow.run_config = KubernetesRun(
    env={"CRED": "[CRED]"},
    image="[REPO]",
    image_pull_policy="Always",
    cpu_request="250m",
    cpu_limit="500m",
    memory_request="256Mi",
    memory_limit="512Mi",
    image_pull_secrets=["abc-def"],
    job_template="""
    apiVersion: batch/v1
    kind: Job
    spec:
      template:
        spec:
          containers:
            - name: flow
          nodeSelector:
            nodegroup: xxx
    "
k
Glad you figured this out, but I think this should work. Will ask people on the team with more k8s experience. Did you add the job template to you KubernetesRun?
t
Yes I did add the job_template and not using the image_pull_secrets argument, though it should work too.
Initially try with this, which got incorrectly translate to an array
Copy code
flow.run_config = KubernetesRun(
    env={"CRED": "[CRED]"},
    image="[REPO]",
    cpu_request="250m",
    cpu_limit="500m",
    memory_request="256Mi",
    memory_limit="512Mi",
    job_template="""
    apiVersion: batch/v1
    kind: Job
    spec:
      template:
        spec:
          imagePullSecrets:
            - name: "abc-def"
          containers:
            - name: flow
          nodeSelector:
            nodegroup: xxx
    "