Hi, I keep having a problem of `The secret KUBERNETES_API_KEY was not found` when trying to run a Ku...
t
Hi, I keep having a problem of
The secret KUBERNETES_API_KEY was not found
when trying to run a Kubernetes Task. I thought I’m using in-cluster connection so it shouldn’t be required? Otherwise is there any recommendation on creating a ``KUBERNETES_API_KEY` ? according to: https://docs.prefect.io/api/latest/tasks/kubernetes.html#createnamespaceddeployment
Attempt to use a Prefect Secret that contains a Kubernetes API Key. If 
kubernetes_api_key_secret
 = 
None
 then it will attempt the next two connection methods. By default the value is 
KUBERNETES_API_KEY
 so providing 
None
 acts as an override for the remote connection. 2. Attempt in-cluster connection (will only work when running on a Pod in a cluster) 3. Attempt out-of-cluster connection using the default location for a kube config file
k
Just confirming you registered and ran this with an agent in the cluster?
t
yes, I registered the flow with a local minikube agent uprunning, deployed using
prefect agent kubernetes start
the agent is deployed well, and I can run the job(
dbt-run
) locally without prefect fine:
but when running it on Prefect, it’s always failed for that API_KEY error
k
Wait, the default value is
KUBERNETES_API_KEY
, maybe you just want
kubernetes_api_key_secret=None
so that it uses the in-cluster connection?
t
oh! let me try. Thanks!
where to set it?..
k
In your
CreateNamespacedDeployment
🙏 1
t
works now! cheers!!
one thing I don’t understand, I just ran
CreateNamespacedPod
but it also kicked off to run the job. what’s the difference to
RunNamespacedPod
task then?
k
Maybe if you already have a pod to run that doesn’t need to be created?
t
no, it created a new pod to run it
that’s fine to me actually. just curious
k
I know but what if you already have a pod and you just want to run it (I think)
t
don’t quite understand
is there a way to not repeatedly recreate the job and run it in schedule?
please ignore ^