@@ -15,6 +15,7 @@ This repo hosts a kubernetes operator that is responsible for creating and manag
1515- [ Quick Start] ( #quick-start )
1616 - [ Installation] ( #installation )
1717 - [ Deploying Llama Stack Server] ( #deploying-the-llama-stack-server )
18+ - [ Enabling Network Policies] ( #enabling-network-policies )
1819- [ Developer Guide] ( #developer-guide )
1920 - [ Prerequisites] ( #prerequisites )
2021 - [ Building the Operator] ( #building-the-operator )
@@ -80,11 +81,10 @@ spec:
8081 replicas: 1
8182 server:
8283 distribution:
83- name: ollama
84+ name: starter
8485 containerSpec:
85- port: 8321
8686 env:
87- - name: INFERENCE_MODEL
87+ - name: OLLAMA_INFERENCE_MODEL
8888 value: "llama3.2:1b"
8989 - name: OLLAMA_URL
9090 value: "http://ollama-server-service.ollama-dist.svc.cluster.local:11434"
@@ -104,6 +104,36 @@ Example to create a run.yaml ConfigMap, and a LlamaStackDistribution that refere
104104kubectl apply -f config/samples/example-with-configmap.yaml
105105```
106106
107+ ## Enabling Network Policies
108+
109+ The operator can create an ingress-only ` NetworkPolicy ` for every ` LlamaStackDistribution ` to ensure traffic is limited to:
110+ - Other pods in the same namespace that are part of the Llama Stack deployment (` app.kubernetes.io/part-of: llama-stack ` )
111+ - Components that run inside the operator namespace (default: ` llama-stack-k8s-operator-system ` )
112+
113+ This behavior is guarded by a feature flag and is disabled by default to avoid interfering with existing cluster-level policies. To enable it:
114+
115+ 1 . Identify the namespace where the operator is running. If you used the provided manifests, it is ` llama-stack-k8s-operator-system ` .
116+ 2 . Create or update the ` llama-stack-operator-config ` ConfigMap in that namespace so the ` featureFlags ` entry enables the network policy flag.
117+
118+ ``` bash
119+ cat << 'EOF ' > feature-flags.yaml
120+ apiVersion: v1
121+ kind: ConfigMap
122+ metadata:
123+ name: llama-stack-operator-config
124+ namespace: llama-stack-k8s-operator-system
125+ data:
126+ featureFlags: |
127+ enableNetworkPolicy:
128+ enabled: true
129+ EOF
130+
131+ kubectl apply -f feature-flags.yaml
132+ ```
133+
134+ Within the next reconciliation loop the operator will begin creating a ` <name>-network-policy ` resource for each distribution.
135+ Set ` enabled: false ` (or remove the block) to turn the feature back off; the operator will delete the previously managed policies.
136+
107137## Developer Guide
108138
109139### Prerequisites
0 commit comments