Skip to main content
Swytch Documentation
Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Back to homepage

Sidecar Mode

Give each application Pod a Redis endpoint at localhost:6379. Start with the profile and credential from the quickstart.

Attach to an existing workload

The profile and Secret must be in the application’s namespace. Add this to its Pod template:

spec:
  template:
    metadata:
      annotations:
        swytch.getswytch.com/profile: app-cache

For a Deployment, updating the Pod template starts its normal rollout. Configure the application’s Redis client to use localhost. The operator does not change its environment variables.

Use a Unix socket

Change the profile’s transport:

spec:
  sidecar:
    transport: unix

The operator mounts an emptyDir at /var/run/swytch in regular application containers and the sidecar. Connect to /var/run/swytch/swytch.sock; Redis TCP is disabled. Application init containers do not receive the socket mount.

This volume holds the socket. It does not persist cache data.

Account for Pod resources

spec.memory is the sidecar’s container memory limit. Swytch receives --maxmemory=80%. Set explicit requests when you need predictable scheduling reservations; Kubernetes may default an omitted request to the limit.

Reserve container name swytch, volume name swytch-socket, TCP 9090, UDP 7379, and TCP 6379 for TCP transport. Port and mount collisions declared in the Pod are rejected. hostNetwork Pods are unsupported.

Change or remove a profile

Profile changes and Secret changes require new Pods. Recreate application Pods through your normal rollout process when ready; the operator does not restart them automatically.

To detach Swytch, remove the annotation and recreate the Pods. Deleting the profile alone leaves already injected sidecars running and removes its discovery Service.

Next: local and distributed keys, then pod replacement.