feat: Add NetworkPolicy for Ollama security (Task 3)
All checks were successful
sync-to-forgejo / sync (push) Successful in 22s
All checks were successful
sync-to-forgejo / sync (push) Successful in 22s
Restricts ingress to Ollama service from users, payments, and nxtgauge-ai-assistant only
This commit is contained in:
parent
f0906d2c67
commit
c73b8740b4
2 changed files with 55 additions and 1 deletions
|
|
@ -5,3 +5,4 @@ resources:
|
||||||
- pvc.yaml
|
- pvc.yaml
|
||||||
- deployment.yaml
|
- deployment.yaml
|
||||||
- service.yaml
|
- service.yaml
|
||||||
|
- networkpolicy.yaml
|
||||||
53
apps/ollama/base/networkpolicy.yaml
Normal file
53
apps/ollama/base/networkpolicy.yaml
Normal file
|
|
@ -0,0 +1,53 @@
|
||||||
|
apiVersion: networking.k8s.io/v1
|
||||||
|
kind: NetworkPolicy
|
||||||
|
metadata:
|
||||||
|
name: ollama-ingress-restriction
|
||||||
|
namespace: nxtgauge-ai
|
||||||
|
labels:
|
||||||
|
app: ollama
|
||||||
|
spec:
|
||||||
|
podSelector:
|
||||||
|
matchLabels:
|
||||||
|
app: ollama
|
||||||
|
policyTypes:
|
||||||
|
- Ingress
|
||||||
|
ingress:
|
||||||
|
# Allow traffic from users service (port 11434)
|
||||||
|
- from:
|
||||||
|
- namespaceSelector:
|
||||||
|
matchLabels:
|
||||||
|
name: default
|
||||||
|
podSelector:
|
||||||
|
matchLabels:
|
||||||
|
app: users
|
||||||
|
ports:
|
||||||
|
- protocol: TCP
|
||||||
|
port: 11434
|
||||||
|
# Allow traffic from payments service
|
||||||
|
- from:
|
||||||
|
- namespaceSelector:
|
||||||
|
matchLabels:
|
||||||
|
name: default
|
||||||
|
podSelector:
|
||||||
|
matchLabels:
|
||||||
|
app: payments
|
||||||
|
ports:
|
||||||
|
- protocol: TCP
|
||||||
|
port: 11434
|
||||||
|
# Allow traffic from nxtgauge-ai-assistant service
|
||||||
|
- from:
|
||||||
|
- namespaceSelector:
|
||||||
|
matchLabels:
|
||||||
|
name: nxtgauge-ai
|
||||||
|
podSelector:
|
||||||
|
matchLabels:
|
||||||
|
app: nxtgauge-ai-assistant
|
||||||
|
ports:
|
||||||
|
- protocol: TCP
|
||||||
|
port: 11434
|
||||||
|
# Allow traffic from within the same namespace (for health checks, etc.)
|
||||||
|
- from:
|
||||||
|
- podSelector: {}
|
||||||
|
ports:
|
||||||
|
- protocol: TCP
|
||||||
|
port: 11434
|
||||||
Loading…
Add table
Reference in a new issue