fleet Documentation

Deprecated functionality

While fleet and Kubernetes are similar in functionality, some fleet features do not have direct equivalents in Kubernetes. Workarounds exist for many of these cases. Several of these features and workarounds are outlined below.

Container Dependencies

Fleet uses systemd service dependencies to outline a limited dependency graph. When units are co-located, then containers may be specified to start in a specific order; only beginning a service after others it depends on have begun. This is not really a fleet feature but rather a systemd feature. It is limited by the design and features of systemd.

There are two workarounds for this in Kubernetes:

  1. Grouping related containers in a Pod.
  2. Init containers

Grouping containers in Pods

This is the most straightforward to approach the problem. Pods specs can contain multiple containers. By grouping related containers in one Pod, Kubernetes will co-locate them and monitor if all of the containers are running.

Init containers

Init containers are containers that run before a Pod starts up. They can be used to manage assets, wait for services, and perform general setup. A pod is not scheduled until it's init containers complete.

Graceful Exit Command (ExecStop)

Fleet uses the systemd option ExecStop to instruct systemd how to stop a service gracefully. (The fleet ExecStop feature exhibits a bug depending on how service termination is invoked.)

While this exact feature does not exist in Kubernetes, the ExecPreStop does have an analogue: lifecycle.preStop.

A Pod lifecycle.preStop directive specifies a command run before Kubernetes terminates an application with SIGTERM. This provides a mechanism to perform pre-termination actions to stop applications gracefully.

Here is an example of using lifecycle.preStop, inspired by the Kubernetes docs:

apiVersion: v1
kind: Pod
  name: web-server
  - name: nginx
    image: nginx
    - containerPort: 80
          # SIGTERM triggers a quick exit; gracefully terminate instead
          command: ["/usr/sbin/nginx","-s","quit"]

After a grace period, a running application in the pod will be killed via SIGTERM. The pod's terminationGracePeriodSeconds defaults to 30 seconds, but can be set to a longer period.

More information can be found in the Kubernetes Pods user guide.