Hi, I want to access the ConfigMap in my GKE cluster through Google Batch, but I can't find the relevant API in the GKE API documentation. What I can think of so far is to mount the ConfigMap in the GKE cluster to NFS for access. other better way?
APIs and reference | Google Kubernetes Engine (GKE) | Google Cloud
Assuming you are trying to access the contents of a ConfigMap from within one or more containers running on GKE, you can actually mount ConfigMaps as volumes on your pods/containers:
ConfigMap:
apiVersion: v1
kind: ConfigMap
metadata:
name: special-config
namespace: default
data:
SPECIAL_LEVEL: very
SPECIAL_TYPE: charm
Mount as volume:
...
spec:
containers:
- name: test-container
image: registry.k8s.io/busybox
command: [ "/bin/sh", "-c", "ls /etc/config/" ]
volumeMounts:
- name: config-volume
mountPath: /etc/config
volumes:
- name: config-volume
configMap:
# Provide the name of the ConfigMap containing the files you want
# to add to the container
name: special-config
Hi,I see what you mean,but Google Batch is not part of GKE cluster, it's part of GCE, how to load ConfigMap into Google Batch?
Oh - I see. So you have a GKE cluster and want to then use the same ConfigMap in GCE Batch?
Yes, can it be done?