Skip to content
This repository was archived by the owner on May 8, 2025. It is now read-only.
This repository was archived by the owner on May 8, 2025. It is now read-only.

How to enforce SSL/TLS everywhere through this operator? #309

Open
@a-roberts

Description

@a-roberts

Hey everyone, I've been trying this operator successfully on OpenShift after making a few small changes and applying a workaround #288 in to use Flink 1.11.

Now I'd like to check that I can use SSL/TLS everywhere as per https://ci.apache.org/projects/flink/flink-docs-stable/ops/security-ssl.html. I had a look through https://github.com/GoogleCloudPlatform/flink-on-k8s-operator/blob/3352bf51c0d3167ba87a626cf5d6ef37753b8c57/docs/crd_v1alpha1.md and I noticed there's useTLS for the Ingress endpoint (I assume for external access, so perhaps securing the Flink UI?) but I don't see anything for internal communications.

Is it possible to achieve this through the operator and if so, how? I don't see it is as a supported feature on the main readme but I am thinking it would be done through an override in here for the FlinkCluster CR

spec:
  flinkProperties:

I'm wondering if anyone's done this before, I'll have a try anyway and see what happens, but couldn't find any documentation on this for the operator itself (lemme know if I've missed something please) and hence my curiosity in the event it's something not yet available.

Thanks!

Update, you can do it - make the keystore/truststore etc upfront first and then create a secret + mount it in. I don't care for any of these values being known (just testing on my laptop)

kind: FlinkCluster
metadata:
  name: tls-flink-cluster-1-11
spec:
  jobManager:
    volumeMounts:
      - name: flink-secret-volume
        mountPath: /etc/flink-secrets
    volumes:
    - name: flink-secret-volume
      secret:
        secretName: flink-tls-secret
    accessScope: Cluster
    resources:
      limits:
        memory: 600Mi
        cpu: "1.0"
  taskManager:
    volumeMounts:
      - name: flink-secret-volume
        mountPath: /etc/flink-secrets
    volumes:
    - name: flink-secret-volume
      secret:
        secretName: flink-tls-secret
    replicas: 1
    resources:
      limits:
        memory: 1Gi
        cpu: "1.0"
  image:
    name: flink:scala_2.12-java8
    # https://ci.apache.org/projects/flink/flink-docs-stable/ops/security-ssl.html is helpful for this part.
    web.submit.enable: "false"
    taskmanager.numberOfTaskSlots: "1"
    jobmanager.heap.size: ""                # set empty value (only for Flink version 1.11 or above)
    jobmanager.memory.process.size: 1gb   # job manager memory limit  (only for Flink version 1.11 or above)
    taskmanager.heap.size: ""               # set empty value
    taskmanager.memory.process.size: 1gb    # task manager memory limit
    security.ssl.internal.enabled: "true"
    security.ssl.internal.keystore: /etc/flink-secrets/internal-keystore.p12
    security.ssl.internal.truststore: /etc/flink-secrets/internal-keystore.p12
    security.ssl.internal.keystore-password: DD562D1B-742F-45AB-9228-98874C356076 # Replace with generated password
    security.ssl.internal.truststore-password: DD562D1B-742F-45AB-9228-98874C356076 # Replace with generated password
    security.ssl.internal.key-password: DD562D1B-742F-45AB-9228-98874C356076 # Replace with generated password
    security.ssl.rest.enabled: "true"
    security.ssl.rest.keystore: /etc/flink-secrets/rest-keystore.p12
    security.ssl.rest.truststore: /etc/flink-secrets/ca-truststore.p12
    security.ssl.rest.keystore-password: DD562D1B-742F-45AB-9228-98874C356076 # Replace with generated password
    security.ssl.rest.truststore-password: DD562D1B-742F-45AB-9228-98874C356076 # Replace with generated password
    security.ssl.rest.key-password: DD562D1B-742F-45AB-9228-98874C356076 # Replace with generated password

I made the files upfront and have them in a secret with the following format:

apiVersion: v1
  kind: Secret
  type: Opaque
  metadata:
    name: flink-tls-secret
  data:
    ca-keystore.p12: $(cat ./certs/ca-keystore.p12 | base64 | tr -d '\n')
    ca-truststore.p12: $(cat ./certs/ca-truststore.p12 | base64 | tr -d '\n')
    internal-keystore.p12: $(cat ./certs/internal-keystore.p12 | base64 | tr -d '\n')
    rest-keystore.p12: $(cat ./certs/rest-keystore.p12 | base64 | tr -d '\n')
    store-password.txt: $(cat ./certs/store-password.txt | base64 | tr -d '\n')

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions