Providers, Spark, and S3 connection
ready for your DAGs.
Three scenarios: what the Airflow image already ships, the connection to S3-compatible storage, and running Spark from the tasks. Each one covers: the chart default, the block commented line by line, and a step-by-step with verification.
Airflow DAGs talk to other systems through connections and through the libraries in the image. The image of the tdp-airflow chart ships all the Airflow providers, the packages with the operators and hooks of each system, in addition to Spark and the ClickHouse libraries. The chart writes one connection to S3-compatible storage, enabled in the TDP-Settings.s3Connection block. The metadata database, embedded or external, is covered in Airflow Configuration.
Your environment
If you fill in your environment details here, the examples and commands on the page use what you provided. The namespace, the release name and the values file are your choices, not the chart's.
Scenarios
- 1 · How it connects
- 2 · S3 connection
- 3 · Spark in the DAGs
What the image ships: providers, Spark, ClickHouse and LDAP, ready in the task pods.
Airflow connects to the other components through what ships in the image: the providers and libraries that the tasks use to talk to each system. By default, the image already ships the providers, Spark and the ClickHouse and LDAP libraries, and the chart writes no connection to Airflow. The following tabs cover the connection to S3-compatible storage, such as the Ozone S3 Gateway (scenario 2), and Spark in the tasks, with the Spark History Server (scenario 3).
You are going to write DAGs that talk to other systems and want to know what is already available. The chart's Airflow runs with a TDP image that extends the official Apache Airflow image: it ships all the apache-airflow-providers-* providers, at the versions pinned by the Airflow constraints file, plus TDP extras. The tasks run with this same image, so all of this is already in them. The image ships providers and libraries for Spark, Kafka, Trino, Hive, ClickHouse, S3, Kubernetes and LDAP.
All the apache-airflow-providers-* from the Airflow constraints file, at the versions it pins.
PySpark and the Spark distribution, copied from the TDP Spark image, with the Delta, Iceberg and S3 JARs, for spark-submit and for a local SparkSession. Java (OpenJDK 17) comes along. SPARK_HOME is /opt/spark and spark-submit is on the PATH. See scenario 3.
The Python libraries clickhouse-connect and clickhouse-driver.
python-ldap, for login through the directory. See Security - Airflow.
Airflow and the task pods
- Airflow. Orchestrates the DAGs. Each task runs in its own pod, with the same Airflow image. Chart default:
KubernetesExecutor. (tdp-airflow.executor) - Task pods. The image ships all the Airflow providers, PySpark with the Spark distribution and Java, and the ClickHouse and LDAP libraries. Chart default:
TDP Airflow image. (tdp-airflow.defaultAirflowTag)
Of the connections that DAGs use, the chart writes only the one to S3-compatible storage, in scenario 2.
A Secret and an Airflow connection to the Ozone S3 Gateway, MinIO or another S3 endpoint.
An Airflow connection stores the type, address and credentials of an external system, and DAGs use it by name. The chart writes a connection to S3-compatible storage (the Ozone S3 Gateway, MinIO or another S3 endpoint), but it is off by default, in the TDP-Settings.s3Connection block.
When on, the block does two things: it creates a Secret with the connection parameters and, after every install and upgrade, writes to Airflow the connection with the name, type, keys and endpoint you provide. The connection is deleted and recreated each time, with the values from the file. Your DAGs read and write to this storage, and you want the connection ready in Airflow.
Off (TDP-Settings.s3Connection.enabled). No Secret, no connection.
With Ozone security off (no Kerberos, the default), the S3 Gateway accepts any non-empty key pair, and the ozone-s3-credentials Secret does not exist. With it on, the S3 Gateway validates the keys: use those of the ozone-s3-credentials Secret (aws_access_key_id and aws_secret_access_key), which exists only in the Ozone namespace. See Integrations - Ozone and Ozone security in the GitOps kit.
The S3 connection stored in Airflow
- Airflow. Orchestrates the DAGs. Each task runs in its own pod, with the same Airflow image. Chart default:
KubernetesExecutor. (tdp-airflow.executor) - Task pods. The image ships all the Airflow providers, PySpark with the Spark distribution and Java, and the ClickHouse and LDAP libraries. Chart default:
TDP Airflow image. (tdp-airflow.defaultAirflowTag) - S3 connection Secret. Created by the chart with the keys name, type, access_key, secret_key and uri. Chart default:
not created. (TDP-Settings.s3Connection.secretName) - Airflow S3 connection. Written to Airflow by a Job, after every install and upgrade, under the name set in TDP-Settings.s3Connection.name. Chart default:
not created. (TDP-Settings.s3Connection.name) - S3 endpoint. The S3-compatible storage set in uri. With Ozone security on, the S3 Gateway validates the keys. (
TDP-Settings.s3Connection.uri)
1TDP-Settings:2s3Connection:3 enabled: true4 secretName: "<S3_SECRET_NAME>"5 name: "<CONNECTION_NAME>"6 type: "aws"7 accessKey: "<S3_ACCESS_KEY>"8 secretKey: "<S3_SECRET_KEY>"9 uri: "https://<S3_ENDPOINT>"
TDP-Settings does not sit under the chart prefix: it is a block of the TDP chart itself, at the root of the values file.
- At the root (linha 1). TDP-Settings does not sit under the chart prefix: it is a block of the TDP chart itself, at the root of the values file.
- Turns on the connection (linha 3). Creates the Secret and the Job that writes the connection to Airflow.
- Secret (linha 4). Name of the Secret created by the chart, with the keys name, type, access_key, secret_key and uri.
- Connection name (linha 5). The name under which the connection appears in Airflow and by which the DAGs reference it.
- Type (linha 6). The connection type in Airflow. aws is the Amazon provider type, used for S3-compatible endpoints.
- Keys (linha 7). The S3 access key and secret key, written as the connection's login and password. With Ozone without security, any non-empty pair. With security on, those of the ozone-s3-credentials Secret.
- Endpoint (linha 9). Written as endpoint_url in the connection's extras.
Add the block to the values file
Replace the Secret, the connection name, the keys and the endpoint with yours.
Prefer not to leave accessKey and secretKey in a versioned file: pass them with --set or through an external secrets tool.
Apply it to the release
The chart creates the Secret and, after the installation, writes the connection.
helm upgrade --install <RELEASE_NAME> oci://registry.tecnisys.com.br/tdp/charts/tdp-airflow \
--version 3.0.3 \
-n <NAMESPACE> --create-namespace \
-f <VALUES_FILE>
Check the Secret and the connection
The Secret exists and the connection appears in Airflow.
kubectl -n <NAMESPACE> get secret <S3_SECRET_NAME>
It worked when
<CONNECTION_NAME> connection appears among the connections in the Airflow UI.If the connection disappears or goes back to the old value
It is recreated on every install and upgrade with the values from the file. Change it in the file, not in the UI.
spark-submit in the tasks, the event logs in the History Server and the Ozone keys.
Your tasks run Spark: spark-submit or a SparkSession in PySpark. The Airflow image already ships Spark, so the driver, the process that coordinates the execution of the job, runs inside the task pod, outside the pods of the tdp-spark chart. Two things are up to it. If the Spark History Server, the interface that shows completed runs, is on, the driver writes the event logs, the record of each run, to the same directory that the History Server reads. And, with Ozone security on, the driver itself reads AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY from the ozone-s3-credentials Secret.
PySpark, the Spark distribution with the Delta, Iceberg and S3 JARs, and Java. spark-submit is on the PATH.
Off by default in the Spark chart (spark.historyServer.enabled). When on, it reads the event logs from spark.historyServer.eventLog.dir.
The AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY variables, read from the ozone-s3-credentials Secret. The variables in tdp-airflow.extraEnv reach all the Airflow containers, including the task pods.
Spark running in the Airflow tasks
- Airflow. Orchestrates the DAGs. Each task runs in its own pod, with the same Airflow image. Chart default:
KubernetesExecutor. (tdp-airflow.executor) - Task pods. The image ships all the Airflow providers, PySpark with the Spark distribution and Java, and the ClickHouse and LDAP libraries. Chart default:
TDP Airflow image. (tdp-airflow.defaultAirflowTag) - Spark History Server. Reads the event logs that the drivers write. Drivers that run in Airflow tasks write to the same directory. Chart default:
off. (spark.historyServer.enabled) - ozone-s3-credentials Secret. With Ozone security on, the Spark drivers that run in Airflow read AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY from it. It exists only in the Ozone namespace: with Airflow in another namespace, it is copied there.
1spark.eventLog.enabled true2spark.eventLog.dir s3a://warehouse/spark-events
The driver starts writing the execution history.
- Turns on the event logs (linha 1). The driver starts writing the execution history.
- Same directory (linha 2). The directory that the History Server reads, in spark.historyServer.eventLog.dir in the Spark chart. The value shown is that chart's default when the event logs are not on a volume.
Point the event logs at the History ServerOpcional
Only if the Spark History Server is on.
Set spark.eventLog.enabled and spark.eventLog.dir in the driver's Spark configuration, with the History Server's directory.
It worked when
Give the Ozone keys to the driverOpcional
Only with Ozone security on.
The driver needs AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY, with the values of the aws_access_key_id and aws_secret_access_key keys of the ozone-s3-credentials Secret. Variables set in tdp-airflow.extraEnv reach the task pods.
This Secret exists only in the Ozone namespace: with Airflow in another namespace, copy it to the Airflow namespace, and again after every key rotation. See Integrations - Ozone.
For the History Server, the volumes and S3 on the Spark side, see Spark Configuration.
When something goes wrong
Troubleshooting
Paste the error message or choose the symptom. The answer comes with the cause, what to do and the command.
- S3 access denied with Ozone security on. Cause: With Ozone security on, the S3 Gateway only accepts keys issued by the Ozone Manager: an arbitrary pair no longer works. What to do: In the S3 connection, use the aws_access_key_id and aws_secret_access_key keys of the ozone-s3-credentials Secret (scenario 2). In the DAGs' Spark, use the AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY variables from that Secret (scenario 3).
- Changes made to the S3 connection in the UI disappear. Cause: On every install and upgrade, the chart deletes the connection named in TDP-Settings.s3Connection.name and recreates it with the values from the file. What to do: Change the connection in the values file, not in the UI.
- The Spark job does not appear in the History Server. Cause: The driver that runs in the Airflow task does not write the event logs to the directory that the History Server reads. What to do: Set spark.eventLog.enabled and spark.eventLog.dir in the driver's Spark configuration (scenario 3).
- Another problem. Cause: Start with the state of the pods and the namespace events. What to do: The events in time order show what keeps the pod or the Job from running.
Integration parameters
These keys sit at the root of the values file, without the chart prefix.
7 of 7 parameters
| Parameter | Description | Chart default |
|---|---|---|
TDP-Settings.s3Connection.enabledS3 connection | Creates the Secret and writes the S3 connection to Airflow | false |
TDP-Settings.s3Connection.secretNameS3 connection | Name of the Secret with the connection parameters | tdp-airflow-minio-connection |
TDP-Settings.s3Connection.nameS3 connection | Name of the connection in Airflow | <s3-connection-name> |
TDP-Settings.s3Connection.typeS3 connection | Type of the connection in Airflow | aws |
TDP-Settings.s3Connection.accessKeyS3 connection | S3 access key | <s3-access-key> |
TDP-Settings.s3Connection.secretKeyS3 connection | S3 secret key | "" |
TDP-Settings.s3Connection.uriS3 connection | S3-compatible endpoint, written as the connection's endpoint_url | https://<s3-endpoint> |
Next steps
Configuration
Airflow Configuration
First contact, external database, volumes and publishing at a URL.