Skip to content

Sidecar Deployment

Sidecar Deployment

Run ContractShield as a separate container in your Kubernetes pod.

Kubernetes Configuration

apiVersion: v1
kind: Pod
spec:
containers:
- name: app
image: your-app:latest
env:
- name: CONTRACTSHIELD_URL
value: "http://localhost:3100"
- name: contractshield
image: contractshield/sidecar:latest
ports:
- containerPort: 3100
volumeMounts:
- name: policy
mountPath: /policy.yaml
subPath: policy.yaml
volumes:
- name: policy
configMap:
name: contractshield-policy

Unix Socket (Lower Latency)

For ~0.1ms latency instead of ~1ms:

volumes:
- name: cs-socket
emptyDir: {}
containers:
- name: app
volumeMounts:
- name: cs-socket
mountPath: /var/run/contractshield
env:
- name: CONTRACTSHIELD_SOCKET
value: "/var/run/contractshield/pdp.sock"
- name: contractshield
volumeMounts:
- name: cs-socket
mountPath: /var/run/contractshield
env:
- name: UNIX_SOCKET
value: "/var/run/contractshield/pdp.sock"