# cursor-agent-api-proxy — node5 instance (cluster-local second copy). # Runs in namespace cursor-agent-api-n5 so its ServiceExports never collide with # the node4 instance's ServiceImports in ns cursor-agent-api (the federation # operator overwrites same-name ServiceImports on every reconcile). # Consumed locally, e.g. from box3: http://cursor-agent-api.cursor-agent-api-n5.svc.cluster.local:4646 # (Bearer token from secret cursor-proxy-internal-token in this namespace — # independent from the node4 instance's token). --- apiVersion: v1 kind: PersistentVolumeClaim metadata: name: cursor-agent-state namespace: cursor-agent-api-n5 spec: accessModes: - ReadWriteOnce storageClassName: local-storage resources: requests: storage: 1Gi --- apiVersion: apps/v1 kind: Deployment metadata: name: cursor-agent-api namespace: cursor-agent-api-n5 labels: app: cursor-agent-api spec: replicas: 1 strategy: type: Recreate selector: matchLabels: app: cursor-agent-api template: metadata: labels: app: cursor-agent-api spec: automountServiceAccountToken: false imagePullSecrets: - name: dcr-registry-auth-ro initContainers: - name: bootstrap-cursor image: dcr.trinitysan.by/infra/cursor-agent-api-proxy:11-7503bdaa102ee3ec42fe3ab7151c915369dba63f # {"$imagepolicy": "flux-system:cursor-agent-api-proxy"} imagePullPolicy: IfNotPresent env: - name: CURSOR_API_KEY valueFrom: secretKeyRef: name: cursor-auth key: CURSOR_API_KEY command: - /app/scripts/bootstrap-cursor.sh volumeMounts: - name: cursor-state mountPath: /home/nobody/.cursor securityContext: allowPrivilegeEscalation: false capabilities: drop: - ALL readOnlyRootFilesystem: false runAsNonRoot: true runAsUser: 65534 runAsGroup: 65534 securityContext: runAsNonRoot: true runAsUser: 65534 runAsGroup: 65534 fsGroup: 65534 fsGroupChangePolicy: OnRootMismatch seccompProfile: type: RuntimeDefault containers: - name: proxy image: dcr.trinitysan.by/infra/cursor-agent-api-proxy:11-7503bdaa102ee3ec42fe3ab7151c915369dba63f # {"$imagepolicy": "flux-system:cursor-agent-api-proxy"} imagePullPolicy: IfNotPresent ports: - name: http containerPort: 4646 - name: http-edge containerPort: 4647 env: - name: CURSOR_API_KEY valueFrom: secretKeyRef: name: cursor-auth key: CURSOR_API_KEY - name: PORT value: "4646" - name: PROXY_SESSION_TTL_MS value: "120000" - name: PROXY_MAX_CONCURRENT_SESSIONS value: "4" - name: ACP_REQUEST_TIMEOUT_MS value: "1500000" - name: PROXY_INTERNAL_TOKEN valueFrom: secretKeyRef: name: cursor-proxy-internal-token key: PROXY_INTERNAL_TOKEN - name: EDGE_PORT value: "4647" volumeMounts: - name: cursor-state mountPath: /home/nobody/.cursor - name: agent-home mountPath: /home/agent-home - name: tmp mountPath: /tmp livenessProbe: httpGet: path: /health port: http initialDelaySeconds: 30 periodSeconds: 30 readinessProbe: httpGet: path: /health port: http initialDelaySeconds: 10 periodSeconds: 10 resources: requests: cpu: 200m memory: 512Mi limits: cpu: "2" memory: 2Gi securityContext: allowPrivilegeEscalation: false readOnlyRootFilesystem: true capabilities: drop: - ALL volumes: - name: cursor-state persistentVolumeClaim: claimName: cursor-agent-state # Writable HOME for the sandboxed agent children (uid 65533). - name: agent-home emptyDir: sizeLimit: 512Mi # Writable /tmp for the proxy itself (session workdirs + MCP sockets); # the root filesystem is read-only. - name: tmp emptyDir: sizeLimit: 1Gi --- apiVersion: v1 kind: Service metadata: name: cursor-agent-api namespace: cursor-agent-api-n5 annotations: service.kubernetes.io/topology-mode: Auto spec: selector: app: cursor-agent-api ports: - name: http port: 4646 targetPort: http --- # Edge service: consumed by the Authentik outpost on node2 via the mesh. # NOT exported through MCS — the outpost reaches it over the federation # network using the node4 Service address. apiVersion: v1 kind: Service metadata: name: cursor-agent-api-edge namespace: cursor-agent-api-n5 annotations: service.kubernetes.io/topology-mode: Auto spec: selector: app: cursor-agent-api ports: - name: http-edge port: 4647 targetPort: http-edge --- apiVersion: multicluster.x-k8s.io/v1alpha1 kind: ServiceExport metadata: name: cursor-agent-api namespace: cursor-agent-api-n5 --- # Edge service exported for the Authentik outpost (node2) via MCS. apiVersion: multicluster.x-k8s.io/v1alpha1 kind: ServiceExport metadata: name: cursor-agent-api-edge namespace: cursor-agent-api-n5 --- # Ingress isolation: # - port 4646 (internal, token-gated): any source (cluster + federation # mesh). Auth is enforced by PROXY_INTERNAL_TOKEN in the app layer — # the Authentik trust header is NOT accepted on this port. # - port 4647 (edge): Authentik outpost only. The outpost runs on node2; # cross-cluster mesh traffic is SNATed by kilo to the node2 gateway # address (10.4.2.1/32), so the CIDR below is the node2 kilo gateway, # not the node2 pod CIDR. Direct in-cluster access to the edge port is # blocked, so the X-Authentik-Username trust header cannot be forged # locally. apiVersion: networking.k8s.io/v1 kind: NetworkPolicy metadata: name: cursor-agent-api-ingress namespace: cursor-agent-api-n5 spec: podSelector: matchLabels: app: cursor-agent-api policyTypes: - Ingress ingress: - from: - ipBlock: cidr: 0.0.0.0/0 ports: - protocol: TCP port: 4646 - from: - ipBlock: cidr: 10.4.2.1/32 ports: - protocol: TCP port: 4647