prefect-server

by prefect

Helm chartv2026.11.24211251App 3.9.5Verified publisher

Prefect server application bundle

About this chart

prefect-server

Prefect server application bundle

Homepage: https://github.com/PrefectHQ

Installing the Chart

To install the chart with the release name prefect-server:

helm repo add prefect https://prefecthq.github.io/prefect-helm
helm install prefect-server prefect/prefect-server

Prefect Configuration

Container Port // Port Forwarding

Without making any modifications to the values.yaml file, you can access the Prefect UI by port forwarding either the Server pod or service with the following command and visiting http:localhost:4200:

kubectl port-forward svc/prefect-server 4200:4200

Note: If you choose to make modifications to either the server.prefectApiUrl or service.port, make sure to update the other value with the updated port!

Basic Auth

Prefect documentation on basic auth

Self-hosted Prefect servers can be equipped with a Basic Authentication string for an administrator/password combination.

The format of the auth string is admin:<my-password> (no brackets).

server:
  basicAuth:
    enabled: true
    authString: "admin:pass"

Alternatively, you can provide an existing Kubernetes Secret containing the auth string credentials. The secret must contain a key auth-string with the value of the auth string.

kubectl create secret generic prefect-basic-auth --from-literal=auth-string='admin:my-password'
server:
  basicAuth:
    enabled: true
    existingSecret: prefect-basic-auth

Container seccomp profile

The chart passes server.containerSecurityContext to the server container. Set seccompProfile there when a policy requires a profile on the container. For a Localhost profile, set localhostProfile to a path relative to the kubelet's seccomp profile directory.

server:
  containerSecurityContext:
    seccompProfile:
      type: Localhost
      localhostProfile: profiles/restricted.json

Health Probes

The server enables startup, liveness, and readiness probes by default. Their default paths follow server.apiBasePath. The startup and liveness probes call /health, which confirms that the HTTP server responds. The readiness probe calls /ready, which confirms that Prefect can connect to its database. These endpoints do not check Redis connectivity.

The startup probe allows the server up to five minutes to become healthy with the default settings. Kubernetes waits for it to succeed before running the liveness and readiness probes. You can tune each probe under its config key or disable it through enabled.

You can also override server.livenessProbe.path or server.readinessProbe.path. For example, point the liveness probe at /api/ready if sustained database connectivity failures should restart the server pod instead of only removing it from service:

server:
  startupProbe:
    enabled: false
  livenessProbe:
    path: "/api/ready"
  readinessProbe:
    enabled: false

Background Services Configuration

The Prefect server includes background services related to scheduling and cleanup. By default, these run in the same deployment as the web server, but they can be separated for better resource management and scalability.

Support for this separation was added to provide a path to scaling your deployment as your usage grows. If you are orchestrating a lot of work, you may need more web services to handle requests than background services to field the increased API requests.

By default, the web services and background services share a connection pool to the database, but their connection needs are very different and even antagonistic with each other at times. Splitting the background services out also allows you to tune the database connections for each deployment (pool size, timeout, etc.), which can help with the database load.

The separate deployment for background services is currently limited to one replica because it has not been optimized for running multiple copies. Additionally, many background services run on a loop between 5 and 60 seconds, so if they go down, Kubernetes should bring them back up after a health check without much disruption.

Splitting the background services is optional, and is likely not necessary if you are not having any issues with your setup.

To run background services in a separate deployment:

[!WARNING] Version Requirement: When using backgroundServices.runAsSeparateDeployment: true, you must use Prefect 3.4.16 or later. Earlier versions have a bug where the --no-services flag doesn't fully disable background services, causing Redis connection errors in the server pod.

backgroundServices:
  runAsSeparateDeployment: true

# Use the bundled Redis chart
# See the next section for more details on other deployment options
redis:
  enabled: true

This configuration is recommended when:

  • You're experiencing database connection pool contention
  • You need different scaling policies for the web server and background services
  • You want to monitor and manage resource usage separately

You can read more about this architecture in the How to scale self-hosted Prefect guide.

Redis Configuration

This section applies when enabling the use of Background Services.

For a simple deployment, you can use the bundled Redis chart by setting the following:

redis:
  enabled: true

This will automatically configure the Prefect server and background services to use the bundled Redis instance with the correct connection string information.

If you want to use the bundled Redis chart but need to customize the configuration, you can do so by providing additional values under the redis section. For example:

redis:
  enabled: true

  auth:
    # set a custom password for the Redis instance
    password: "dontpanic!"

You can find additional configuration values in the Bitnami Redis chart values.yaml file.

NOTE Using the embedded Bitnami Redis chart his is not intended for production use, and is only included to provide a functional proof of concept installation.

Using an External Redis Instance

If you want to use an existing or external Redis instance, do not set redis.enabled. Provide the connection details in the backgroundServices.messaging.redis section:

backgroundServices:
  runAsSeparateDeployment: true
  messaging:
    redis:
      host: external.redis.host.example.com
      username: marvin
      password: paranoid!

If you want to reference an existing Kubernetes Secret for the Redis password instead of providing it in plain text, use the existingSecret field:

backgroundServices:
  runAsSeparateDeployment: true
  messaging:
    redis:
      host: external.redis.host.example.com
      username: marvin
      existingSecret: my-redis-secret
      existingSecretPasswordKey: redis-password  # default key name

The existingSecretPasswordKey field defaults to redis-password to match the Bitnami Redis chart convention. Set it to a different value if your secret uses a different key.

Using a Redis Connection URL

You can provide the full connection URL in the url field instead of the individual fields. The chart passes it to Prefect as PREFECT_REDIS_MESSAGING_URL:

backgroundServices:
  runAsSeparateDeployment: true
  messaging:
    redis:
      url: rediss://marvin:[email protected]:6379/0

Because the URL usually contains credentials, you can read it from an existing Kubernetes Secret instead. Set existingSecret to the Secret name and existingSecretUrlKey to the key that holds the URL:

backgroundServices:
  runAsSeparateDeployment: true
  messaging:
    redis:
      existingSecret: my-redis-secret
      existingSecretUrlKey: redis-url

When a URL is set, the chart ignores the host, port, db, username, password and ssl fields, and the connection details of the bundled Redis chart. A URL read from a Secret takes precedence over the url field.

Prefect does not read the Redis password from a separate setting when a URL is set. If Redis requires a password, including the bundled Redis chart, put the password in the URL. If the username or password contains characters that have a meaning in URLs, such as /, ?, #, @, : or %, percent-encode them, for example / as %2F. This applies to the url field and to a URL stored in a Secret. For the same reason, the chart fails the install when url and existingSecret are set without existingSecretUrlKey, because the password in that Secret would not be used.

PostgreSQL Configuration

Handling Connection Secrets

Using the bundled PostgreSQL chart

By default, Bitnami's PostgreSQL Helm Chart will be deployed. This is not intended for production use, and is only included to provide a functional proof of concept installation.

In this scenario, you'll need to provide either one of the following fields:

  1. postgresql.auth.password: a password you want to set for the prefect user (default: prefect-rocks)

  2. postgresql.auth.existingSecret: name of an existing secret in your cluster with the following field:

    • connection-string: fully-quallified connection string in the format of postgresql+asyncpg://{username}:{password}@{hostname}/{database}
      • username = postgresql.auth.username
      • hostname = <release-name>-postgresql.<release-namespace>:<postgresql.containerPorts.postgresql>
      • database = postgresql.auth.database

Two secrets are created when not providing an existing secret name:

  1. prefect-server-postgresql-connection: used by the prefect-server deployment to connect to the postgresql database.

  2. <release-name>-postgresql-0: defines the postgresql.auth.username's password on the postgresql server to allow successful authentication from the prefect server.

Using an external instance of PostgreSQL

If you want to disable the bundled PostgreSQL chart and use an external instance, use the externalDatabase block. It is only for external databases; for databases managed by this chart, continue to configure the bundled PostgreSQL chart with postgresql or the embedded SQLite database with sqlite.

Database connection configuration is applied in this order:

  1. sqlite.enabled=true uses the embedded SQLite database.
  2. externalDatabase.connectionString uses a literal external database connection URL.
  3. externalDatabase.existingSecret with externalDatabase.connectionStringSecretKey reads a full external database connection URL from an existing Secret.
  4. externalDatabase component fields and Secret keys compose an external database connection URL from driver, username, password, host, port, and name.
  5. Existing secret/postgresql behavior is used when none of the above externalDatabase options are set.
postgresql:
  enabled: false

secret:
  # Option 1: provide the name of an existing secret following the instructions above.
  create: false
  name: <existing secret name>

  # Option 2: provide the connection string details directly
  create: true
  username: myuser
  password: mypass
  host: myhost.com
  port: 1234
  database: mydb

If your external database credentials are split across Secret keys and values, use the externalDatabase block instead. This is useful for operators that create immutable credential Secrets, such as the Zalando Postgres Operator.

postgresql:
  enabled: false

externalDatabase:
  existingSecret: user.clustername.credentials.postgresql.acid.zalan.do
  driver: postgresql+asyncpg
  usernameSecretKey: username
  passwordSecretKey: password
  host: postgres.internal.svc.cluster.local
  port: "5432"
  name: prefect

When externalDatabase.connectionString or externalDatabase.connectionStringSecretKey is set, that full connection string takes precedence over the component settings.

Connecting with SSL configured

  1. Mount the relevant certificate to /home/prefect/.postgresql so that it can be found by asyncpg. This is the default location postgresql expects per their documentation.

    server:
      extraVolumes:
        - name: db-ssl-secret
          secret:
            secretName: db-ssl-secret
            defaultMode: 384
      extraVolumeMounts:
        - name: db-ssl-secret
          mountPath: "/home/prefect/.postgresql"
          readOnly: true
    postgresql:
      enabled: false
      auth:
        existingSecret: external-db-connection-string
    
  2. Create a secret to hold the ca certificate for the database with the key root.crt

    apiVersion: v1
    kind: Secret
    metadata:
      name: db-ssl-secret
    data:
      root.crt: BASE64ENCODECERTIFICATE=
    type: Opaque
    
  3. Set the connection string in the existing secret following this format - ?ssl=verify-ca is crucial:

    postgresql+asyncpg://{username}:{password}@{hostname}/{database}?ssl=verify-ca
    

Database Migrations

Database migrations are handled differently depending on your deployment mode.

Single deployment (default): Prefect automatically runs database migrations on server startup. No additional configuration is needed because there is only one server process managing the database.

Separate deployment mode (backgroundServices.runAsSeparateDeployment: true): The chart creates a dedicated Kubernetes Job as a Helm pre-upgrade/post-install hook to run migrations before the deployments start. This prevents multiple server processes (API server and background services) from racing to migrate the database simultaneously. Both deployments set `PREFECT_SERVE

Deploy prefect-server with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has prefect-server on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartprefect-server is pinned at v2026.11.24211251 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below
opentenant validate opentenant.yaml
terraform init && terraform apply