Organize Flokoa resources across Kubernetes namespaces
Learn patterns for structuring Flokoa Agents, Models, ModelProviders, and AgentTools across namespaces to support teams and environments.
All Flokoa Custom Resources are namespace-scoped, which means the way you organize them across namespaces directly affects your team’s ability to share configuration, enforce security boundaries, and isolate environments from one another. A thoughtful namespace layout prevents duplicated secrets, makes RBAC policies easier to write, and keeps production workloads cleanly separated from development. This guide covers the main patterns, from a single-namespace setup for quick starts to a fully multi-tenant shared-resources layout for larger teams.
Cross-namespace references are fully supported in Flokoa. An Agent in one namespace can reference a Model in another, a Model can reference a ModelProvider in yet another, and an Agent can reference AgentTools spread across multiple namespaces — all by adding an optional namespace: field to the reference.
The simplest possible layout puts every resource — Agents, Models, ModelProviders, and AgentTools — in a single namespace. This is ideal for individual developers, proof-of-concept work, and small teams that do not yet need resource isolation.Create the namespace and deploy everything into it:
All resources are co-located, so no cross-namespace references are needed. The trade-off is that all team members share access to the same secrets and configuration, which becomes a concern as the team or the number of agents grows.
For teams deploying multiple agents or applications, the recommended layout separates resources by their reusability and sensitivity:
shared-resources → ModelProviders (API credentials, one per provider)shared-models → Models (tuned model configs for team-wide use)shared-tools → AgentTools (common API integrations)app-namespace → Agents (application-specific deployments)
This structure means provider credentials live in exactly one place, and rotating an API key requires updating a single secret. Applications reference the shared resources without needing copies of the configuration.Create the namespaces:
When you need hard boundaries between development, staging, and production workloads, give each environment its own namespace. This approach pairs naturally with namespace-scoped ResourceQuotas, NetworkPolicies, and RBAC rules.
kubectl create namespace developmentkubectl create namespace stagingkubectl create namespace production
Apply environment-specific resources to each namespace:
Staging and production may share a ModelProvider if cost and configuration allow, but they should generally use different secrets to prevent a leaked dev credential from affecting production traffic.
Reference any Flokoa resource in a different namespace by adding the namespace: field to the reference. The following Agent spec demonstrates referencing a Model from shared-models and two AgentTools from shared-tools:
Use Kubernetes RBAC to control which service accounts and users can read resources in shared namespaces. The following Role grants an agent service account the ability to read AgentTool resources in the shared-tools namespace, without giving it broader write access:
Apply the same pattern for Model and ModelProvider access in their respective namespaces. Keeping roles narrow — granting only get and list on the specific resource types needed — follows the principle of least privilege.
Use this checklist when planning your namespace layout:
Isolate secrets by environment. Never share Kubernetes Secrets containing production API keys with development namespaces.
Centralise provider credentials. One ModelProvider per LLM provider in a shared namespace prevents drift and simplifies key rotation.
Separate reusable tools from app-specific ones. Common integrations belong in shared-tools; one-off tools can live in the application namespace.
Use namespace labels consistently. Labels like environment: production make it easy to apply NetworkPolicies and audit queries across namespaces.
Scope RBAC to the minimum required. Grant get/list on shared resources, not full * verbs.
Document your layout. A short README or architecture diagram in your GitOps repo prevents namespace sprawl as the team grows.
Prefer namespace: references over copying YAML. Duplicating a ModelProvider or AgentTool into every application namespace creates maintenance overhead and inconsistency.