Hi everyone! I have a Prefect agent running in Kub...
# ask-community
l
Hi everyone! I have a Prefect agent running in Kubernetes cluster as a deployment.
Copy code
prefect agent kubernetes install -t ${TOKEN} --rbac --label ${CLUSTER_NAME} | kubectl apply -f -
I’m trying to use the Prefect Cloud Automations to do health monitoring of the agent. However, I can’t do it at the agent installation phase as per the Prefect Docs. And I can’t manage to add the
agent_config_id
argument to a running agent either. I tried GraphQL, but didn’t find a proper mutation to make it. Is there any way to make the Automations work for Prefect agent running in Kubernetes cluster for my case? 🙏
🆙 1
z
Hi @Lan Yao -- you can modify the
start
command to include the id
Copy code
❯ prefect agent kubernetes install                                                                                
---
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: prefect-agent
  name: prefect-agent
spec:
  replicas: 1
  selector:
    matchLabels:
      app: prefect-agent
  template:
    metadata:
      labels:
        app: prefect-agent
    spec:
      containers:
      - args:
        - prefect agent kubernetes start
        command:
        - /bin/bash
        - -c
        env:
        - name: PREFECT__CLOUD__AGENT__AUTH_TOKEN
          value: ''
        - name: PREFECT__CLOUD__API
          value: <https://api.prefect.io>
        - name: NAMESPACE
          value: default
        - name: IMAGE_PULL_SECRETS
          value: ''
        - name: PREFECT__CLOUD__AGENT__LABELS
          value: '[]'
        - name: JOB_MEM_REQUEST
          value: ''
        - name: JOB_MEM_LIMIT
          value: ''
        - name: JOB_CPU_REQUEST
          value: ''
        - name: JOB_CPU_LIMIT
          value: ''
        - name: IMAGE_PULL_POLICY
          value: ''
        - name: SERVICE_ACCOUNT_NAME
          value: ''
        - name: PREFECT__BACKEND
          value: cloud
        - name: PREFECT__CLOUD__AGENT__AGENT_ADDRESS
          value: http://:8080
        - name: PREFECT__CLOUD__API_KEY
          value: ''
        - name: PREFECT__CLOUD__TENANT_ID
          value: ''
        image: prefecthq/prefect:latest
        imagePullPolicy: Always
        livenessProbe:
          failureThreshold: 2
          httpGet:
            path: /api/health
            port: 8080
          initialDelaySeconds: 40
          periodSeconds: 40
        name: agent
Copy code
- args:
        - prefect agent kubernetes start --agent-config-id "<id>"
We can get that added to the install options as well
m
Hey @Zanie! Thanks for replying. I’m Maikel, from Lan’s team. At the moment we are only using the command above, shared by Lan, to install the agent on Kubernetes. How would we go about updating the YAML file (as we don’t have this file anywhere) ? Btw, having the
config_id
as an option added to the
prefect agent kubernetes install
command would be the ideal.
z
Yep!
prefect agent kubernetes install
will just print the yaml and you can modify it before passing it to
kubectl
l
Great news for today! @Zanie Thank you so much for the quick turn around and the following-up. We’ll wait for the release. It’ll give us a big help!
💪 1