Skip to main content

Install the operator

Goal: install the AgentFlowEngine operator and bring up an engine from one custom resource.

Prerequisites​

  • A cluster you can kubectl apply to, with a kubeconfig.
  • The afe image published on GitHub Container Registry (ghcr.io/agentflowengine/afe), or loaded where the cluster can pull it.
  • kubectl on your machine.

The operator is namespace-scoped and reference-first. It creates and owns the stateless objects: the serve and worker Deployments, the Services, the config ConfigMap, the Ingress and the ScaledObject. The namespaces, the worker's RBAC, the envSecret, the data Secrets and the storage, runtime and ingress classes are your manifests. They ship as examples under deploy/operator/admin/.

On kind, make kind-up does all of this for you. It installs the operator and applies the one AgentFlowEngine of deploy/kind/engine.yaml, and deploy/operator/admin/ is that cluster's admin source too. The steps below are the manual path on any other cluster.

Steps​

  1. Apply your admin manifests:

    kubectl apply -f deploy/operator/admin/namespace.yaml
    kubectl apply -f deploy/operator/admin/rbac.yaml
    kubectl apply -f deploy/operator/admin/env-secret.yaml
    kubectl apply -f deploy/operator/admin/data-secrets.yaml
    kubectl apply -f deploy/operator/admin/classes.yaml

    Fill the Secrets first. The repository commits empty values, never a credential. Keep the classes your cluster already provides.

  2. Install the operator, its CRDs and its RBAC:

    make operator-install AFE_IMAGE_TAG=0.0.0-test.1
    kubectl -n afe rollout status deployment/afe-operator

    The operator image is an explicit install switch. make operator-install renders deploy/operator with the tag and refuses to run without one. With kustomize on your machine you can set the same value by hand with kustomize edit set image ghcr.io/agentflowengine/afe=ghcr.io/agentflowengine/afe:<tag>.

    The ghcr.io/agentflowengine/afe package is private: the operator Pod needs a pull credential with read:packages. Create a ghcr-pull Secret of type kubernetes.io/dockerconfigjson in the operator's namespace and attach it to the afe-operator ServiceAccount, or the Pod stays on ImagePullBackOff (401). Keep the token off the command line: build the .dockerconfigjson and pipe it to kubectl create secret generic ghcr-pull --type=kubernetes.io/dockerconfigjson --from-file=.dockerconfigjson=/dev/stdin.

  3. Create the source ConfigMap from your flow folder. A prompt must be inline text or a file in the same ConfigMap, because a ConfigMap has no folders:

    kubectl -n afe create configmap afe-source --from-file=config/
  4. Write the AgentFlowEngine and apply it. Every secret is a reference, never a value:

    apiVersion: afe.dev/v1alpha1
    kind: AgentFlowEngine
    metadata:
    name: afe
    namespace: afe
    spec:
    config:
    configMapRef:
    name: afe-source
    afe:
    store:
    external:
    secretRef:
    name: afe-postgres
    key: dsn
    broker:
    external:
    secretRef:
    name: afe-redis
    key: AFE_REDIS_URL
    sandbox:
    namespace: afe-sandbox
    envSecret: afe-sandbox-env
    deployment:
    image:
    repository: ghcr.io/agentflowengine/afe
    tag: "X.Y.Z" # a published release tag
    api:
    replicas: 2
    apiTokenSecretRef:
    name: afe-secrets
    key: AFE_API_TOKEN
    workers:
    replicas: 2
    concurrency: 4
    # The model key and the Git token both stay worker-only; serve never holds a credential.
    envSecretRefs:
    - { name: afe-secrets, key: OPENROUTER_API_KEY }
    - { name: afe-secrets, key: GITHUB_TOKEN }
  5. Watch the installation become ready:

    kubectl -n afe get agentflowengine afe -o wide
    kubectl -n afe get pods
    kubectl -n afe get agentflowengine afe \
    -o jsonpath='{.status.conditions[*].type}{"\n"}'

    The Ready condition is the AND of the required ones. status.revision is the configuration revision the workloads run.

  6. Reach the API. Without an Ingress, forward the Service:

    kubectl -n afe port-forward svc/afe-api 8765:8765
    export AFE_API_TOKEN=$(kubectl -n afe get secret afe-secrets \
    -o jsonpath='{.data.AFE_API_TOKEN}' | base64 -d)
    afe tickets

Verify the image​

Every published image is signed keyless with cosign and carries an SPDX SBOM and a provenance attestation from docker buildx. The SBOM is attached as a cosign attestation, so the same identity that signs the image also covers it and cosign verify-attestation finds it. No signing key and no secret is stored. The signature is bound to the release workflow's own identity.

cosign verify \
--certificate-identity-regexp 'https://github.com/agentflowengine/afe/.*' \
--certificate-oidc-issuer https://token.actions.githubusercontent.com \
ghcr.io/agentflowengine/afe:X.Y.Z
cosign verify-attestation --type spdxjson \
--certificate-identity-regexp 'https://github.com/agentflowengine/afe/.*' \
--certificate-oidc-issuer https://token.actions.githubusercontent.com \
ghcr.io/agentflowengine/afe:X.Y.Z

The cosign verify-attestation command exits with code 0 when the SPDX attestation verifies. A non-zero code means the image does not carry the attestation the release published.

Troubleshooting​

ConfigValidated=False The operator could not validate the folder it built from the ConfigMap and the generated Runtime. The condition message carries the same per-field messages afe validate prints. Fix the manifests in the ConfigMap and re-apply, or update the CR if the error is in spec.afe.

RevisionPinned=False, reason RevisionMismatch spec.config.revision does not match the computed revision. The operator names both hashes and publishes nothing, so the running workloads stay as they are. Set the pin to the computed revision, or remove it.

Ready=False, reason ResourceConflict An object with a desired name exists without the operator's ownerReference. The operator adopts nothing. Delete the foreign object, or rename it, then let the next reconcile run.

StoreReady=False, reason CloudNativePGMissing The CR asks for a managed store but the postgresql.cnpg.io CRD is not installed. Install CloudNativePG, or switch spec.afe.store to external.

Switched from managed to external, and the database is still running The operator keeps the managed Cluster, StatefulSet and Service, since they hold your data. The StoreReady or BrokerReady condition names them, and its reason stays External. Delete them by hand with kubectl delete. Deleting the CR itself still deletes them.

operator-install needs AFE_IMAGE_TAG make operator-install ran without a tag. Pick a published tag and run it again: make operator-install AFE_IMAGE_TAG=X.Y.Z. A raw kubectl apply -k deploy/operator renders the placeholder __AFE_IMAGE_TAG__. The operator Pod then stops at ImagePullBackOff, naming the tag it could not pull.

The worker Pod crash-loops with invalid configuration: model '…': set … The worker resolves the model providers, so it needs every model key. Name the key in deployment.workers.envSecretRefs: the operator projects it into the workers only. serve runs no harness and calls no provider, so no credential reaches it, neither the model keys nor the Git token.

See also​