<@ULVA73B9P> We have deployed a self-hosted Prefec...
# ask-marvin
c
@Marvin We have deployed a self-hosted Prefect(3.0.9) in our Kubernetes Cluster through helm chart and I am trying to run a Kubernetes Job but facing an issue
m
I'm here to help you with that. Let me search for relevant Prefect 3.x documentation and GitHub issues to see if there is any information that can help us resolve the issue you're experiencing with running a Kubernetes Job using a self-hosted Prefect 3.0.9 deployment. I'll start by looking into common issues running Kubernetes Jobs and general Prefect Kubernetes deployments. One moment please. It looks like there are a few considerations and issues related to running Kubernetes Jobs with Prefect 3.0.9 that could be affecting you. 1. Kubernetes Cluster Configuration: When setting up Prefect in Kubernetes using the Helm chart, ensure that your Kubernetes cluster is properly configured. The Prefect 3.x documentation on Kubernetes infrastructure suggests ensuring that your worker has proper access and permissions for job creation. 2. Issues from GitHub: - One issue mentions encountering a
ModuleNotFoundError
when running simultaneous flows using a custom image with
prefect-dbt
. While this might not be directly related to your issue, it's worth checking if there are any similar errors related to module imports or missing dependencies in your logs. More information can be found here. - Another issue notes failures with
httpx.LocalProtocolError
, potentially due to network or connectivity issues between your agents and Prefect API. You might want to review your network settings or check for similar errors in your setup. Details are here. Based on this, here are a few things you can try: - Verify Helm Deployment: Ensure your Prefect Helm deployment is correctly configured. Follow the documentation carefully to make sure all steps were completed without error. - Check Permissions: Verify that your Kubernetes worker nodes have the appropriate permissions to execute Prefect flows. - Examine Logs: Look at your Prefect logs to identify any specific errors that could provide more context. - Network Settings: If errors like LocalProtocolError are present, ensure that your Kubernetes network settings aren't blocking traffic between your Prefect components. If you continue to face issues, these links should provide you with additional guidance, or you may find it helpful to raise a new issue on Prefect's GitHub with specific errors you're encountering.
c
I am using this code to run a flow :
Copy code
job = KubernetesJob.from_yaml_file(
    credentials=k8s_credentials,
    manifest_path="/usr/src/app/sample_file.yaml",
)

# Save the job for reuse
job.save("my-k8s-job", overwrite=True)

@flow
def kubernetes_orchestrator():
    logger = get_run_logger()
    run_namespaced_job(job, print_func=logger.info)
and getting this issue: File "/usr/local/lib/python3.11/site-packages/kubernetes_asyncio/config/kube_config.py", line 413, in load_and_set self._load_cluster_info() File "/usr/local/lib/python3.11/site-packages/kubernetes_asyncio/config/kube_config.py", line 387, in _load_cluster_info self.cert_file = FileOrData( ^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/kubernetes_asyncio/config/kube_config.py", line 81, in init if data_key_name in obj: ^^^^^^^^^^^^^^^^^^^^ TypeError: argument of type 'NoneType' is not iterable