Spaces:
Paused
Paused
File size: 2,846 Bytes
4156c57 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 | apiVersion: v1
kind: Namespace
metadata:
name: medical-ai
labels:
name: medical-ai
compliance: hipaa
---
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: medical-ai-default-deny
namespace: medical-ai
spec:
podSelector: {}
policyTypes: ["Ingress","Egress"]
egress:
- to:
- namespaceSelector:
matchLabels:
kubernetes.io/metadata.name: kube-system
ports:
- protocol: UDP
port: 53
- protocol: TCP
port: 53
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: ai-service
namespace: medical-ai
spec:
replicas: 2
selector:
matchLabels:
app: ai-service
template:
metadata:
labels:
app: ai-service
spec:
securityContext:
runAsNonRoot: true
runAsUser: 1001
fsGroup: 1001
seccompProfile:
type: RuntimeDefault
containers:
- name: ai-service
image: your-registry/ai-service:latest
ports:
- containerPort: 7860
name: http
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
runAsNonRoot: true
capabilities:
drop: ["ALL"]
env:
- name: DATABASE_URL
valueFrom:
secretKeyRef:
name: medical-ai-secrets
key: DATABASE_URL
- name: REDIS_URL
valueFrom:
secretKeyRef:
name: medical-ai-secrets
key: REDIS_URL
- name: SECRET_KEY
valueFrom:
secretKeyRef:
name: medical-ai-secrets
key: SECRET_KEY
- name: JWT_SECRET_KEY
valueFrom:
secretKeyRef:
name: medical-ai-secrets
key: JWT_SECRET_KEY
readinessProbe:
httpGet:
path: /health/ready
port: http
initialDelaySeconds: 20
livenessProbe:
httpGet:
path: /health/live
port: http
initialDelaySeconds: 30
volumeMounts:
- name: tmp
mountPath: /tmp
- name: uploads
mountPath: /app/uploads
- name: models
mountPath: /app/models
resources:
requests:
cpu: "500m"
memory: "2Gi"
limits:
cpu: "2000m"
memory: "4Gi"
volumes:
- name: tmp
emptyDir: {}
- name: uploads
emptyDir: {}
- name: models
emptyDir: {}
---
apiVersion: v1
kind: Service
metadata:
name: ai-service
namespace: medical-ai
spec:
selector:
app: ai-service
ports:
- port: 80
targetPort: http
|