Repository: dask/distributed

Issue:
Setting worker lifetime stagger only possible via CLI
**Describe the issue**:
Configuring [worker lifetime stagger](https://docs.dask.org/en/stable/configuration.html#distributed.worker.lifetime.stagger) seems to be only possible via the CLI, as it defaults to `"0 seconds"` [here](https://github.com/dask/distributed/blob/f3556782c5002613d66cae14f95e13f6ec215a59/distributed/cli/dask_worker.py#L193), leading to it never being `None` here: 
https://github.com/dask/distributed/blob/d87cea954aed8d2e9a49fc88fe0bf4aace805f08/distributed/worker.py#L827-L829 which leads to the 

**Minimal Complete Verifiable Example**:


```python
# Workers are started with the lifetime config set through environment variables:
#     DASK_DISTRIBUTED__WORKER__LIFETIME__DURATION="20 minutes"
#     DASK_DISTRIBUTED__WORKER__LIFETIME__STAGGER="10 minutes"

from typing import Tuple

import dask
from dask.distributed import Client
from distributed import get_worker


def get_worker_lifetime_and_stagger() -> Tuple[float, str]:
    return (
        get_worker().lifetime,
        dask.config.get("distributed.worker.lifetime.stagger"),
    )


if __name__ == '__main__':
    client = Client("<URL>")
    lifetimes_and_staggers = client.run(get_worker_lifetime_and_stagger)
    print(lifetimes_and_staggers)  # Returns correct stagger but incorrect lifetime
```

**Environment**:

- Dask version: 2022.12.1
- Python version: 3.8.15
- Operating System: linux-64
- Install method (conda, pip, source): conda



Discussion:

Resolving patch:
diff --git a/distributed/cli/dask_worker.py b/distributed/cli/dask_worker.py
--- a/distributed/cli/dask_worker.py
+++ b/distributed/cli/dask_worker.py
@@ -190,8 +190,7 @@
 @click.option(
     "--lifetime-stagger",
     type=str,
-    default="0 seconds",
-    show_default=True,
+    default=None,
     help="Random amount by which to stagger lifetime values",
 )
 @click.option(
@@ -204,8 +203,7 @@
 @click.option(
     "--lifetime-restart/--no-lifetime-restart",
     "lifetime_restart",
-    default=False,
-    show_default=True,
+    default=None,
     required=False,
     help="Whether or not to restart the worker after the lifetime lapses. "
     "This assumes that you are using the --lifetime and --nanny keywords",


Test patch:
diff --git a/distributed/cli/tests/test_dask_worker.py b/distributed/cli/tests/test_dask_worker.py
--- a/distributed/cli/tests/test_dask_worker.py
+++ b/distributed/cli/tests/test_dask_worker.py
@@ -610,6 +610,39 @@ def dask_setup(worker):
         assert foo == "setup"
 
 
+@pytest.mark.slow
+@gen_cluster(nthreads=[], client=True)
+async def test_set_lifetime_stagger_via_env_var(c, s):
+    # Ensure that lifetime stagger can be set via an environment variable
+    env = os.environ.copy()
+    env["DASK_DISTRIBUTED__WORKER__LIFETIME__DURATION"] = "10 seconds"
+    env["DASK_DISTRIBUTED__WORKER__LIFETIME__STAGGER"] = "2 seconds"
+    with popen(["dask", "worker", s.address], env=env), popen(
+        ["dask", "worker", s.address], env=env
+    ):
+        await c.wait_for_workers(2)
+        [lifetime1, lifetime2] = (
+            await c.run(lambda dask_worker: dask_worker.lifetime)
+        ).values()
+        assert lifetime1 != lifetime2
+        assert 8 <= lifetime1 <= 12
+        assert 8 <= lifetime2 <= 12
+
+
+@pytest.mark.slow
+@gen_cluster(nthreads=[], client=True)
+async def test_set_lifetime_restart_via_env_var(c, s):
+    # Ensure that lifetime restart can be set via an environment variable
+    env = os.environ.copy()
+    env["DASK_DISTRIBUTED__WORKER__LIFETIME__RESTART"] = "True"
+    with popen(["dask", "worker", s.address], env=env):
+        await c.wait_for_workers(1)
+        [lifetime_restart] = (
+            await c.run(lambda dask_worker: dask_worker.lifetime_restart)
+        ).values()
+        assert lifetime_restart
+
+
 @pytest.mark.slow
 @pytest.mark.parametrize("nanny", ["--nanny", "--no-nanny"])
 def test_timeout(nanny):