Tony Yun

    Tony Yun

    11 months ago
    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
    Kevin Kho

    Kevin Kho

    11 months ago
    Just confirming you registered and ran this with an agent in the cluster?
    Tony Yun

    Tony Yun

    11 months ago
    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
    Kevin Kho

    Kevin Kho

    11 months ago
    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?
    Tony Yun

    Tony Yun

    11 months ago
    oh! let me try. Thanks!
    where to set it?..
    Kevin Kho

    Kevin Kho

    11 months ago
    In your
    CreateNamespacedDeployment
    Tony Yun

    Tony Yun

    11 months ago
    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?
    Kevin Kho

    Kevin Kho

    11 months ago
    Maybe if you already have a pod to run that doesn’t need to be created?
    Tony Yun

    Tony Yun

    11 months ago
    no, it created a new pod to run it
    that’s fine to me actually. just curious
    Kevin Kho

    Kevin Kho

    11 months ago
    I know but what if you already have a pod and you just want to run it (I think)
    Tony Yun

    Tony Yun

    11 months ago
    don’t quite understand
    is there a way to not repeatedly recreate the job and run it in schedule?
    please ignore ^