Retrieving Password from Secrets in Kubernetes Spark Application through Spark Operator

113 Views Asked by At

I have a question related to kubernetes spark operator, am trying to pass the spark configurations through spec->sparkConf. I am not not able to find a way to get the password spark.cassandra.auth.password from secrets.

Here is my sparkapplication yaml. I would really appreciate input on this.

apiVersion: "sparkoperator.k8s.io/v1beta2"
kind: SparkApplication
metadata:
  name: cmptest
  namespace: abc
spec:
  type: Scala
  mode: cluster
  image: "something/sparknet/something:spark-3.2.0-bin-hadoop3.2-latest"
  imagePullPolicy: Always
  #imagePullSecrets:
  #  - myregistrykey
  mainClass: sparknet.cmptest.Main
  mainApplicationFile: "https://something/something-SNAPSHOT-assembly.jar"
  sparkVersion: "3.2.0"
  sparkConf:
    spark.cassandra.connection.host: "cassandra"
    spark.cassandra.auth.username: "cassandra"
    spark.cassandra.auth.password: "${CASSANDRA_PASSWORD I WANT TO GET FROM SECRET}"
    spark.connection.timeout_ms: "200000"
    spark.cassandra.input.consistency.level: "ONE"
    spark.cassandra.output.ignoreNulls: "false"
    spark.cassandra.output.consistency.level: "ONE"
  driver:
    memory: 8142m
    labels:
      version: 3.2.0
    serviceAccount: spark-driver
    volumeMounts:
      - name: "test-volume"
        mountPath: "/tmp"
  executor:
    cores: 6
    instances: 6
    memory: 8142m
    labels:
      version: 3.2.0
    volumeMounts:
      - name: "test-volume"
        mountPath: "/tmp"
0

There are 0 best solutions below