Skip to main content
Version 3.0

S3 keys outside the values file,
pods with a known identity.

Three scenarios: taking the S3 keys out of the values file, understanding the identity of the pods, and using the Ozone keys with security enabled. Each one covers: the values file block commented line by line and a step-by-step with verification.

ChartVersion3.0.3TypeapplicationAppVersion4.0.2
CompatibilityKubernetes1.32+OpenShift4.19+Rancher2.10.x+

The tdp-spark chart provides no S3 keys or passwords of its own: storage access keys are yours, in the values file or a Secret, and the master, workers and History Server read them from the same place. For installation, workers and History Server, see Spark Configuration.

Your environment

If you fill in your environment details here, the examples and commands on the page use what you entered. The namespace, the release name and the values file are your choices, not the chart's.

Scenarios​

Move keys out of the values file and load them as environment variables.

Spark accesses S3-compatible storage with a key pair, and the chart provides none: the endpoint and keys are yours. Writing the keys in hadoopConfig works, but they remain in the values file and the core-site.xml ConfigMap. The alternative is a Secret containing AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY, loaded as environment variables in the master and workers: Spark copies these values to fs.s3a.access.key and fs.s3a.secret.key. The image's Python libraries, such as PyIceberg, read the same variables.

Chart default

No keys: neither in hadoopConfig nor in a Secret (spark.master.extraEnvVarsSecret and spark.worker.extraEnvVarsSecret are empty). The credentials provider reads keys from hadoopConfig or the pod's AWS_* variables.

History Server

Uses the Secret in spark.historyServer.extraEnvVarsSecret or, when empty, the master's Secret, including in the init container that creates the event log directory.

Where the pods get the S3 keys

Where keys are stored

Your choice changes the commands and passages below.

namespace <NAMESPACE>S3AMaster · WorkersHistory Servercore-site.xmlS3 storage<S3_ENDPOINT>
  1. Spark pods. The master, workers and History Server read S3 keys from core-site.xml or the pod's AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY variables. The History Server uses the master's Secret when it has none of its own.
  2. Keys in the values file. fs.s3a.access.key and fs.s3a.secret.key in hadoopConfig become core-site.xml properties in a ConfigMap. Chart default: no keys. (tdp-spark.hadoopConfig)
  3. S3 storage. The endpoint is set in hadoopConfig, with no chart default.

Where keys are stored: In the values file

namespace <NAMESPACE>S3AMaster · WorkersHistory Servercore-site.xmlS3 storage<S3_ENDPOINT>
  1. Spark pods. The master, workers and History Server read S3 keys from core-site.xml or the pod's AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY variables. The History Server uses the master's Secret when it has none of its own.
  2. Keys in the values file. fs.s3a.access.key and fs.s3a.secret.key in hadoopConfig become core-site.xml properties in a ConfigMap. Chart default: no keys. (tdp-spark.hadoopConfig)
  3. S3 storage. The endpoint is set in hadoopConfig, with no chart default.

Where keys are stored: In a Secret

namespace <NAMESPACE>envS3AMaster · WorkersHistory ServerSecret<S3_SECRET_NAME>S3 storage<S3_ENDPOINT>
  1. Spark pods. The master, workers and History Server read S3 keys from core-site.xml or the pod's AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY variables. The History Server uses the master's Secret when it has none of its own.
  2. Secret containing the keys. A Secret containing AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY, loaded as environment variables in the master and workers. Spark copies them to fs.s3a.access.key and fs.s3a.secret.key. Chart default: none. (spark.master.extraEnvVarsSecret · spark.worker.extraEnvVarsSecret)
  3. S3 storage. The endpoint is set in hadoopConfig, with no chart default.
Choose above to see where pods get their keys.

In the values file. Keys are set in hadoopConfig and reach core-site.xml. This is the shortest approach. In the values file: Best suited when the environment is for testing.

1tdp-spark:
2hadoopConfig:
3 fs.s3a.endpoint: "http://<S3_ENDPOINT>:<S3_PORT>"
4 fs.s3a.access.key: "<S3_ACCESS_KEY>"
5 fs.s3a.secret.key: "<S3_SECRET_KEY>"

They remain in your values file and the core-site.xml ConfigMap. To move them out, choose In a Secret above.

  1. Plaintext keys (linha 4). They remain in your values file and the core-site.xml ConfigMap. To move them out, choose In a Secret above.
Keys in the values file

In a Secret. The Secret contains exactly the keys AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY, because each key becomes an environment variable with the same name. The endpoint remains in hadoopConfig. In a Secret: Best suited when the keys cannot stay in the values file or in the core-site.xml ConfigMap.

Click the markers to understand each line.

1tdp-spark:
2hadoopConfig:
3 fs.s3a.endpoint: "http://<S3_ENDPOINT>:<S3_PORT>"
4
5spark:
6master:
7 extraEnvVarsSecret: <S3_SECRET_NAME>
8worker:
9 extraEnvVarsSecret: <S3_SECRET_NAME>

fs.s3a.access.key and fs.s3a.secret.key are removed from the values file.

  1. No keys here (linha 2). fs.s3a.access.key and fs.s3a.secret.key are removed from the values file.
  2. Master (linha 7). Each Secret key becomes an environment variable in the master. The History Server uses this same Secret when spark.historyServer.extraEnvVarsSecret is empty.
  3. Workers (linha 9). The same Secret in the workers.
Keys in a Secret

Create the SecretOpcional

Only if you chose In a Secret above. The Secret belongs in the same namespace as Spark.

Terminal input
kubectl -n <NAMESPACE> create secret generic <S3_SECRET_NAME> \
--from-literal=AWS_ACCESS_KEY_ID=<S3_ACCESS_KEY> \
--from-literal=AWS_SECRET_ACCESS_KEY=<S3_SECRET_KEY>

Apply to the release

Pods start with keys from the chosen location.

Terminal input
helm upgrade --install <RELEASE_NAME> oci://registry.tecnisys.com.br/tdp/charts/tdp-spark \
--version 3.0.3 \
-n <NAMESPACE> --create-namespace \
-f <VALUES_FILE>

Success criteria

Pods reach Running and an application reads and writes to the bucket, as in the Integrations - Spark test.
If pods remain in CreateContainerConfigError

The Secret does not exist in the Spark namespace or does not contain both keys. See When something goes wrong.

Drivers running outside this chart's pods, such as those in Jupyter notebooks and Airflow tasks, do not receive these variables: they need their own AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY. See Integrations - Airflow.

When something goes wrong​

Troubleshooting

Paste the error message or choose a symptom. The answer includes the cause, what to do and the command.

  1. S3 access fails: no keys. Cause: The chart has no default S3 keys: neither in hadoopConfig nor in a Secret loaded in the master and workers. What to do: Set the keys in hadoopConfig or a Secret (scenario 1).
  2. Access denied after enabling Ozone security. Cause: With Ozone security (Kerberos) enabled, the S3 Gateway only accepts keys issued by Ozone: the key in the ozone-s3-credentials Secret or an additional S3 user's key. What to do: Load one of these keys into the Spark Secret and restart the pods (scenario 3).
  3. Pods still use the old keys. Cause: Environment variables are read when the pod starts. Pods already running keep the old keys. What to do: Restart the release's StatefulSets and Deployments.
  4. Pods in CreateContainerConfigError. Cause: The specified Secret does not yet exist in the namespace, or does not contain the expected keys. What to do: Create the Secret in the same namespace as Spark, with the AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY keys.
  5. Jupyter notebooks or Airflow tasks cannot access S3. Cause: Drivers running outside this chart's pods do not receive the master and worker variables. What to do: The driver itself needs AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY. See Integrations - Airflow, Spark in DAGs scenario.
  6. Other problem. Cause: Start with pod status and namespace events. What to do: Events in chronological order show what prevents the pod from starting.

Best practices​

  • Prefer placeholders in the values file and provide keys through a Secret, Helm's --set or an external secrets tool.
  • Enable Ozone security in any environment beyond a demonstration: without it, the S3 Gateway accepts any key.

All parameters​

The chart prefix is already filled in. Keys without a prefix, such as those in the spark block, belong at the root of the values file.

15 of 15 parameters

ParameterDescriptionChart default
tdp-spark.hadoopConfig.fs.s3a.access.keyS3 keysS3 access key in core-site.xmlno default
tdp-spark.hadoopConfig.fs.s3a.secret.keyS3 keysS3 secret key in core-site.xmlno default
tdp-spark.hadoopConfig.fs.s3a.aws.credentials.providerS3 keysCredentials provider: core-site.xml keys or the pod's AWS_* variablesorg.apache.hadoop.fs.s3a.SimpleAWSCredentialsProvider
spark.master.extraEnvVarsSecretS3 keysSecret loaded as environment variables in the master""
spark.worker.extraEnvVarsSecretS3 keysSecret loaded as environment variables in the workers""
spark.historyServer.extraEnvVarsSecretS3 keysSecret for the History Server and init container. When empty, the master's""
spark.historyServer.extraEnvVarsS3 keysIndividual History Server variables, including keys from a Secret with other names[]
spark.serviceAccount.createIdentityCreates the ServiceAccounttrue
spark.serviceAccount.nameIdentityServiceAccount of the master, workers and History Servertdp-spark-sa
spark.master.securityContextIdentityMaster UID, GID and fsGroup1001
spark.worker.securityContextIdentityWorker UID, GID and fsGroup1001
spark.historyServer.podSecurityContextIdentityHistory Server UID, GID and fsGroup1001
global.compatibility.openshift.adaptSecurityContextIdentityOn OpenShift, lets the SCC assign UID and GID: auto, force or disabledauto
tdp-spark.hadoopConfig.hadoop.security.authenticationHadoopHadoop authenticationsimple
tdp-spark.hadoopConfig.hadoop.security.authorizationHadoopHadoop authorization"false"

Next steps​