Thread
#prefect-community
    Dimosthenis Schizas

    Dimosthenis Schizas

    9 months ago
    Hello dear community. I'm trying to deploy a k8s agent inside a k8s cluster and I'm sstruggling with the manifest. First the manifest asks for
    PREFECT__CLOUD__AGENT__AUTH_TOKEN
    which is deprecated if I understand correctly. Is it correct to assume that I can remove that arg and keep only the
    PREFECT__CLOUD__API_KEY
    Anna Geller

    Anna Geller

    9 months ago
    afaik it’s only there for backwards compatibility. You can ignore the TOKEN argument and only fill out the PREFECT__CLOUD__API_KEY
    Dimosthenis Schizas

    Dimosthenis Schizas

    9 months ago
    Thank you Anna, I appreciate it.
    I feel thought that documentation on k8s agent could be improved. As I'm no expert to k8s, just 1 year of experience, I've struggled a lot
    Anna Geller

    Anna Geller

    9 months ago
    I see. What you can also do is to first generate the YAML file for your agent and apply it only after you manually cross-checked everything in the YAML looks good.
    prefect agent kubernetes install --rbac -k YOUR_API_KEY >> agent.yaml
    Then you can adjust everything in the agent.yaml e.g. add your agent label (for instance “production” or “staging”), add env variables and then apply:
    kubectl apply -f agent.yaml
    Dimosthenis Schizas

    Dimosthenis Schizas

    9 months ago
    If I understand correctly only the API_KEY is required, the rest can be removed/left empty
    Anna Geller

    Anna Geller

    9 months ago
    the label is also super important
    Dimosthenis Schizas

    Dimosthenis Schizas

    9 months ago
    Only to be able to pick up flows? I'm still trying to deploy it correctly and check that it's ok
    Anna Geller

    Anna Geller

    9 months ago
    correct, you would assign label to your agent:
    - name: PREFECT__CLOUD__AGENT__LABELS
      value: '["prod-kubernetes"]'
    and then on your flow:
    with Flow(
        FLOW_NAME, storage=STORAGE, run_config=KubernetesRun(labels=["prod-kubernetes"],),
    ) as flow:
    Dimosthenis Schizas

    Dimosthenis Schizas

    9 months ago
    I have created the manifest using the cmd above
    prefect agent kubernetes install --rbac -k YOUR_API_KEY >> agent.yaml
    and then applied it using
    kubectl apply -f agent.yaml
    The pod errors and after 3 restarts it backs off. Trying to figure out why. Have you encountered something like that before?
    It pulls successfully the image
    prefecthq/prefect:0.15.10-python3.6
    Anna Geller

    Anna Geller

    9 months ago
    also if you happen to see:
    apiVersion: <http://rbac.authorization.k8s.io/v1beta1|rbac.authorization.k8s.io/v1beta1>
    replace it with:
    apiVersion: <http://rbac.authorization.k8s.io/v1|rbac.authorization.k8s.io/v1>
    and you can probably replace the image with a higher python version e.g. prefecthq/prefect:0.15.10-python3.8