简体   繁体   中英

spinnaker mount volume from configmap in read/write mode (0666)

Spinnaker mounts volumes like this:

apiVersion: v1
kind: Pod
metadata:
  ...
spec:
  containers:
    ...
  volumes:
  - configMap:
      defaultMode: 420
      items:
      - key: config
        path: config
      name: kubectl-k8s-integration
    name: "1551221025832"
  - ...

I need the config file to be writeble by everyone so that I can use kubectl config use-context in the container, ie I need defaultMode to be 666 instead of 420. There doesn't seem to be place in the Spinnaker GUI to set this when defining volumes. What am I missing?

Based on https://github.com/spinnaker/spinnaker/issues/2118 , it is not possible.

My workaround: I configure spinnaker to mount the configmap volume to a different filename, and added code to the container that automatically copies to the expected folder; the copy has write-access.

Eg say my configmap has a key named "config", and I was previously mounting the configmap as /home/user/.kube , so .kube/config was the file with permission 420 instead of 666. Well I now mount it as /home/user/root.kube , and the container does the equivalent of cp -r /home/user/root.kube /home/user/.kube when it starts. Now /home/user/.kube/config is writable by user.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM