ovsinit is a utility for safely restarting Open vSwitch daemons (such as
ovs-vswitchd, ovsdb-server, ovn-controller, etc.) in Kubernetes
environments with minimal dataplane disruption.
Traditional Kubernetes rollouts stop the old pod before starting the new one. If the container image isn’t already pulled or startup is slow, the dataplane can be down for several seconds. This leads to:
- Dropped packets
- Connection failures
- Noticeable cutovers in network services
Even with RollingUpdate, Kubernetes typically terminates first, starts
second, which is not ideal for critical network daemons.
ovsinit enables in-place, low-downtime daemon restarts by leveraging
appctl for graceful shutdowns and syscall.Exec to replace the process
without changing its PID. This minimizes disruption during upgrades or
restarts. It is designed to work with rollout strategies in the example
below.
updateStrategy:
type: RollingUpdate
rollingUpdate:
maxUnavailable: 0
maxSurge: 1This ensures the new pod is fully up and ready to take over before the old one exits.
When ovsinit is used as the container entrypoint, it:
- Detects whether the target OVS daemon is already running.
- If so, uses
appctlexitto gracefully stop it. - Waits for the process to terminate.
- Uses
syscall.Execto start the new daemon in place
This provides a smooth handoff between instances without killing the dataplane prematurely.
By starting the new pod before terminating the old one, and letting ovsinit
handle the switchover internally, you:
- Avoid multi-second dataplane outages
- Skip image-pull delays
- Keep
ovsdb-server/ovs-vswitchdstate tightly controlled - Ensure traffic disruption is measured in hundreds of milliseconds, not seconds
In testing, ovsinit consistently reduced restart downtime to a level that is
typically invisible to end users.