Rion Williams
03/06/2024, 4:45 PMGOOGLE_APPLICATION_CREDENTIALS from an existing secret as follows:
podTemplate:
apiVersion: v1
kind: Pod
metadata:
name: pod-template
spec:
containers:
- name: flink-main-container
...
volumeMounts:
- mountPath: /flink/gcs-creds/
name: ...
env:
- name: GOOGLE_APPLICATION_CREDENTIALS
value: /flink/gcs-creds/key.json
- name: ENABLE_BUILT_IN_PLUGINS
value: flink-gs-fs-hadoop-1.17.2.jar
...
volumes:
- name: gcs-key
secret:
secretName: {{ $.Values.myGcsSecretHere }}
serviceAccount: my-service-account
However, in this scenario I’m attempting to see if it’s possible to only use the appropriate service account per the documentation for using service accounts:
apiVersion: v1
kind: Pod
metadata:
name: POD_NAME
namespace: NAMESPACE_NAME
spec:
serviceAccountName: KSA_NAME
which according to docs “mounts a static long-lived credential for the service account into the Pod” which I’d imagine would align/set the GOOGLE_APPLICATION_CREDENTIALS environmental variables in lieu of explicitly setting/mounting it now. I was able to set the namespace metadata on the pod-template but obviously serviceAccountName wasn’t explicitly settable in the `FlinkDeployment`:
podTemplate:
apiVersion: v1
kind: Pod
metadata:
name: pod-template
namespace: my-namespace
Does anyone have any recommendations for this currently?Gyula Fóra
03/07/2024, 6:29 AMRion Williams
03/07/2024, 4:35 PMspec:
image: {{ $values.flink17Image }}
flinkVersion: v1_17
flinkConfiguration:
...
serviceAccount: my-service-account
podTemplate:
Based on the documentation and looking at the pod, it looks like this gets reflected correctly as serviceAccountName. I also have the appropriate nodeSelector set in the deployment as well:
spec:
image: {{ $values.flink17Image }}
...
serviceAccount: my-service-account
...
spec:
nodeSelectors:
iam.gke.io/gke-metadata-server-enabled: "true"
As far as I can tell those should mount the appropriate GCS credentials to the pod (such that the gs-related Hadoop libraries can talk to what they need).Rion Williams
03/07/2024, 4:56 PMgcloud projects get-iam-policy my-project \
--flatten="bindings[].members" \
--format='table(bindings.role)' \
--filter="bindings.members:my-service-account"
ROLE
roles/container.admin
roles/iam.serviceAccountAdmin
roles/iam.workloadIdentityUser
roles/storage.admin