Mounted ConfigMap volume is not served entirely












0














ASP.NET Core SPA with external config in wwwroot/config/config.json



Contents of config.json:



{
"termsAndConditionsLink": "https://some-dev-url.with/legal/terms/"
}


When the file is not being overwritten by a ConfigMap, it works fine and I am able to get the full content of file.



curl https://dev-app.com/config/config.json
{
"termsAndConditionsLink": "https://some-dev-url.with/legal/terms/"
}


When ConfigMap data is mounted to this path with Volume, it is not returned entirely.



curl https://dev-app.com/config/config.json
{
"termsAndCon


The file is present in pod:



pwd
/app/wwwroot/config

ls -la
total 12
drwxrwxrwx 3 root root 4096 Nov 20 08:48 .
drwxr-xr-x 6 root root 4096 Nov 20 08:46 ..
drwxr-xr-x 2 root root 4096 Nov 20 08:48 ..2018_11_20_08_48_02.390652870
lrwxrwxrwx 1 root root 31 Nov 20 08:48 ..data -> ..2018_11_20_08_48_02.390652870
lrwxrwxrwx 1 root root 18 Nov 20 08:48 config.json -> ..data/config.json

cat config.json
{
"termsAndConditionsLink": "https://some-dev-url.with/legal/terms/"
}


ConfigMap.yaml



kind: ConfigMap
apiVersion: v1
metadata:
name: my-config
data:
config.json: |-
{
"termsAndConditionsLink": "https://some-dev-url.with/legal/terms/"
}


Deployment.yaml



apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: my-app
labels:
...
spec:
template:
metadata:
labels:
...
spec:
containers:
...
volumeMounts:
- name: my-volume
mountPath: /app/wwwroot/config
volumes:
- name: my-volume
configMap:
name: my-config









share|improve this question



























    0














    ASP.NET Core SPA with external config in wwwroot/config/config.json



    Contents of config.json:



    {
    "termsAndConditionsLink": "https://some-dev-url.with/legal/terms/"
    }


    When the file is not being overwritten by a ConfigMap, it works fine and I am able to get the full content of file.



    curl https://dev-app.com/config/config.json
    {
    "termsAndConditionsLink": "https://some-dev-url.with/legal/terms/"
    }


    When ConfigMap data is mounted to this path with Volume, it is not returned entirely.



    curl https://dev-app.com/config/config.json
    {
    "termsAndCon


    The file is present in pod:



    pwd
    /app/wwwroot/config

    ls -la
    total 12
    drwxrwxrwx 3 root root 4096 Nov 20 08:48 .
    drwxr-xr-x 6 root root 4096 Nov 20 08:46 ..
    drwxr-xr-x 2 root root 4096 Nov 20 08:48 ..2018_11_20_08_48_02.390652870
    lrwxrwxrwx 1 root root 31 Nov 20 08:48 ..data -> ..2018_11_20_08_48_02.390652870
    lrwxrwxrwx 1 root root 18 Nov 20 08:48 config.json -> ..data/config.json

    cat config.json
    {
    "termsAndConditionsLink": "https://some-dev-url.with/legal/terms/"
    }


    ConfigMap.yaml



    kind: ConfigMap
    apiVersion: v1
    metadata:
    name: my-config
    data:
    config.json: |-
    {
    "termsAndConditionsLink": "https://some-dev-url.with/legal/terms/"
    }


    Deployment.yaml



    apiVersion: extensions/v1beta1
    kind: Deployment
    metadata:
    name: my-app
    labels:
    ...
    spec:
    template:
    metadata:
    labels:
    ...
    spec:
    containers:
    ...
    volumeMounts:
    - name: my-volume
    mountPath: /app/wwwroot/config
    volumes:
    - name: my-volume
    configMap:
    name: my-config









    share|improve this question

























      0












      0








      0







      ASP.NET Core SPA with external config in wwwroot/config/config.json



      Contents of config.json:



      {
      "termsAndConditionsLink": "https://some-dev-url.with/legal/terms/"
      }


      When the file is not being overwritten by a ConfigMap, it works fine and I am able to get the full content of file.



      curl https://dev-app.com/config/config.json
      {
      "termsAndConditionsLink": "https://some-dev-url.with/legal/terms/"
      }


      When ConfigMap data is mounted to this path with Volume, it is not returned entirely.



      curl https://dev-app.com/config/config.json
      {
      "termsAndCon


      The file is present in pod:



      pwd
      /app/wwwroot/config

      ls -la
      total 12
      drwxrwxrwx 3 root root 4096 Nov 20 08:48 .
      drwxr-xr-x 6 root root 4096 Nov 20 08:46 ..
      drwxr-xr-x 2 root root 4096 Nov 20 08:48 ..2018_11_20_08_48_02.390652870
      lrwxrwxrwx 1 root root 31 Nov 20 08:48 ..data -> ..2018_11_20_08_48_02.390652870
      lrwxrwxrwx 1 root root 18 Nov 20 08:48 config.json -> ..data/config.json

      cat config.json
      {
      "termsAndConditionsLink": "https://some-dev-url.with/legal/terms/"
      }


      ConfigMap.yaml



      kind: ConfigMap
      apiVersion: v1
      metadata:
      name: my-config
      data:
      config.json: |-
      {
      "termsAndConditionsLink": "https://some-dev-url.with/legal/terms/"
      }


      Deployment.yaml



      apiVersion: extensions/v1beta1
      kind: Deployment
      metadata:
      name: my-app
      labels:
      ...
      spec:
      template:
      metadata:
      labels:
      ...
      spec:
      containers:
      ...
      volumeMounts:
      - name: my-volume
      mountPath: /app/wwwroot/config
      volumes:
      - name: my-volume
      configMap:
      name: my-config









      share|improve this question













      ASP.NET Core SPA with external config in wwwroot/config/config.json



      Contents of config.json:



      {
      "termsAndConditionsLink": "https://some-dev-url.with/legal/terms/"
      }


      When the file is not being overwritten by a ConfigMap, it works fine and I am able to get the full content of file.



      curl https://dev-app.com/config/config.json
      {
      "termsAndConditionsLink": "https://some-dev-url.with/legal/terms/"
      }


      When ConfigMap data is mounted to this path with Volume, it is not returned entirely.



      curl https://dev-app.com/config/config.json
      {
      "termsAndCon


      The file is present in pod:



      pwd
      /app/wwwroot/config

      ls -la
      total 12
      drwxrwxrwx 3 root root 4096 Nov 20 08:48 .
      drwxr-xr-x 6 root root 4096 Nov 20 08:46 ..
      drwxr-xr-x 2 root root 4096 Nov 20 08:48 ..2018_11_20_08_48_02.390652870
      lrwxrwxrwx 1 root root 31 Nov 20 08:48 ..data -> ..2018_11_20_08_48_02.390652870
      lrwxrwxrwx 1 root root 18 Nov 20 08:48 config.json -> ..data/config.json

      cat config.json
      {
      "termsAndConditionsLink": "https://some-dev-url.with/legal/terms/"
      }


      ConfigMap.yaml



      kind: ConfigMap
      apiVersion: v1
      metadata:
      name: my-config
      data:
      config.json: |-
      {
      "termsAndConditionsLink": "https://some-dev-url.with/legal/terms/"
      }


      Deployment.yaml



      apiVersion: extensions/v1beta1
      kind: Deployment
      metadata:
      name: my-app
      labels:
      ...
      spec:
      template:
      metadata:
      labels:
      ...
      spec:
      containers:
      ...
      volumeMounts:
      - name: my-volume
      mountPath: /app/wwwroot/config
      volumes:
      - name: my-volume
      configMap:
      name: my-config






      kubernetes google-kubernetes-engine configmap






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 21 '18 at 8:34









      edbighead

      41218




      41218
























          1 Answer
          1






          active

          oldest

          votes


















          -1














          Do you mean that any other files in the /app/wwwroot/config directory are gone when mounting a volume at that location from the ConfigMap?



          Have you tried projected volume:



          volumes:
          - name: my-volume
          projected:
          sources:
          - configMap:
          name: my-config


          EDIT: For those that may come across such problem and don't read through the messages below the posts - after exchanging messages with @edbighead, another suggestion was to use subPath in the Deployment to leave the config directory writeable as ConfigMap volume mounts are read-only:



          mountPath: /app/wwwroot/config/config.json 
          subPath: config.json


          That apparently solved the problem.






          share|improve this answer























          • There's only one file in this directory, the original /app/wwwroot/config/config.json, and when it's overwritten by configmap (to use the same image but different configs on different environments), it's not served entirely by kestrel, but only first 15 chars.
            – edbighead
            Nov 22 '18 at 6:58












          • @edbighead - I apparently didn't read thoroughly the whole question and you've provided good level of details. It is a strange behavior. Notice it is probably 16 characters, counting a new line character. Maybe it is just in the question but the ConfigMap's content is the same as in the original config.json. What do you see when the ConfigMap is something totally different? Also, it may be worth trying to use in the Deployment mountPath: /app/wwwroot/config/config.json and add subPath: config.json - this will leave the config directory writeable as ConfigMap volume mounts are read-only.
            – apisim
            Nov 22 '18 at 17:32










          • Thanks, specifying subpath resolved the problem. This is still very strange behavior though.
            – edbighead
            Nov 23 '18 at 10:00













          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53408011%2fmounted-configmap-volume-is-not-served-entirely%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          -1














          Do you mean that any other files in the /app/wwwroot/config directory are gone when mounting a volume at that location from the ConfigMap?



          Have you tried projected volume:



          volumes:
          - name: my-volume
          projected:
          sources:
          - configMap:
          name: my-config


          EDIT: For those that may come across such problem and don't read through the messages below the posts - after exchanging messages with @edbighead, another suggestion was to use subPath in the Deployment to leave the config directory writeable as ConfigMap volume mounts are read-only:



          mountPath: /app/wwwroot/config/config.json 
          subPath: config.json


          That apparently solved the problem.






          share|improve this answer























          • There's only one file in this directory, the original /app/wwwroot/config/config.json, and when it's overwritten by configmap (to use the same image but different configs on different environments), it's not served entirely by kestrel, but only first 15 chars.
            – edbighead
            Nov 22 '18 at 6:58












          • @edbighead - I apparently didn't read thoroughly the whole question and you've provided good level of details. It is a strange behavior. Notice it is probably 16 characters, counting a new line character. Maybe it is just in the question but the ConfigMap's content is the same as in the original config.json. What do you see when the ConfigMap is something totally different? Also, it may be worth trying to use in the Deployment mountPath: /app/wwwroot/config/config.json and add subPath: config.json - this will leave the config directory writeable as ConfigMap volume mounts are read-only.
            – apisim
            Nov 22 '18 at 17:32










          • Thanks, specifying subpath resolved the problem. This is still very strange behavior though.
            – edbighead
            Nov 23 '18 at 10:00


















          -1














          Do you mean that any other files in the /app/wwwroot/config directory are gone when mounting a volume at that location from the ConfigMap?



          Have you tried projected volume:



          volumes:
          - name: my-volume
          projected:
          sources:
          - configMap:
          name: my-config


          EDIT: For those that may come across such problem and don't read through the messages below the posts - after exchanging messages with @edbighead, another suggestion was to use subPath in the Deployment to leave the config directory writeable as ConfigMap volume mounts are read-only:



          mountPath: /app/wwwroot/config/config.json 
          subPath: config.json


          That apparently solved the problem.






          share|improve this answer























          • There's only one file in this directory, the original /app/wwwroot/config/config.json, and when it's overwritten by configmap (to use the same image but different configs on different environments), it's not served entirely by kestrel, but only first 15 chars.
            – edbighead
            Nov 22 '18 at 6:58












          • @edbighead - I apparently didn't read thoroughly the whole question and you've provided good level of details. It is a strange behavior. Notice it is probably 16 characters, counting a new line character. Maybe it is just in the question but the ConfigMap's content is the same as in the original config.json. What do you see when the ConfigMap is something totally different? Also, it may be worth trying to use in the Deployment mountPath: /app/wwwroot/config/config.json and add subPath: config.json - this will leave the config directory writeable as ConfigMap volume mounts are read-only.
            – apisim
            Nov 22 '18 at 17:32










          • Thanks, specifying subpath resolved the problem. This is still very strange behavior though.
            – edbighead
            Nov 23 '18 at 10:00
















          -1












          -1








          -1






          Do you mean that any other files in the /app/wwwroot/config directory are gone when mounting a volume at that location from the ConfigMap?



          Have you tried projected volume:



          volumes:
          - name: my-volume
          projected:
          sources:
          - configMap:
          name: my-config


          EDIT: For those that may come across such problem and don't read through the messages below the posts - after exchanging messages with @edbighead, another suggestion was to use subPath in the Deployment to leave the config directory writeable as ConfigMap volume mounts are read-only:



          mountPath: /app/wwwroot/config/config.json 
          subPath: config.json


          That apparently solved the problem.






          share|improve this answer














          Do you mean that any other files in the /app/wwwroot/config directory are gone when mounting a volume at that location from the ConfigMap?



          Have you tried projected volume:



          volumes:
          - name: my-volume
          projected:
          sources:
          - configMap:
          name: my-config


          EDIT: For those that may come across such problem and don't read through the messages below the posts - after exchanging messages with @edbighead, another suggestion was to use subPath in the Deployment to leave the config directory writeable as ConfigMap volume mounts are read-only:



          mountPath: /app/wwwroot/config/config.json 
          subPath: config.json


          That apparently solved the problem.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Nov 23 '18 at 13:55

























          answered Nov 21 '18 at 21:53









          apisim

          4576




          4576












          • There's only one file in this directory, the original /app/wwwroot/config/config.json, and when it's overwritten by configmap (to use the same image but different configs on different environments), it's not served entirely by kestrel, but only first 15 chars.
            – edbighead
            Nov 22 '18 at 6:58












          • @edbighead - I apparently didn't read thoroughly the whole question and you've provided good level of details. It is a strange behavior. Notice it is probably 16 characters, counting a new line character. Maybe it is just in the question but the ConfigMap's content is the same as in the original config.json. What do you see when the ConfigMap is something totally different? Also, it may be worth trying to use in the Deployment mountPath: /app/wwwroot/config/config.json and add subPath: config.json - this will leave the config directory writeable as ConfigMap volume mounts are read-only.
            – apisim
            Nov 22 '18 at 17:32










          • Thanks, specifying subpath resolved the problem. This is still very strange behavior though.
            – edbighead
            Nov 23 '18 at 10:00




















          • There's only one file in this directory, the original /app/wwwroot/config/config.json, and when it's overwritten by configmap (to use the same image but different configs on different environments), it's not served entirely by kestrel, but only first 15 chars.
            – edbighead
            Nov 22 '18 at 6:58












          • @edbighead - I apparently didn't read thoroughly the whole question and you've provided good level of details. It is a strange behavior. Notice it is probably 16 characters, counting a new line character. Maybe it is just in the question but the ConfigMap's content is the same as in the original config.json. What do you see when the ConfigMap is something totally different? Also, it may be worth trying to use in the Deployment mountPath: /app/wwwroot/config/config.json and add subPath: config.json - this will leave the config directory writeable as ConfigMap volume mounts are read-only.
            – apisim
            Nov 22 '18 at 17:32










          • Thanks, specifying subpath resolved the problem. This is still very strange behavior though.
            – edbighead
            Nov 23 '18 at 10:00


















          There's only one file in this directory, the original /app/wwwroot/config/config.json, and when it's overwritten by configmap (to use the same image but different configs on different environments), it's not served entirely by kestrel, but only first 15 chars.
          – edbighead
          Nov 22 '18 at 6:58






          There's only one file in this directory, the original /app/wwwroot/config/config.json, and when it's overwritten by configmap (to use the same image but different configs on different environments), it's not served entirely by kestrel, but only first 15 chars.
          – edbighead
          Nov 22 '18 at 6:58














          @edbighead - I apparently didn't read thoroughly the whole question and you've provided good level of details. It is a strange behavior. Notice it is probably 16 characters, counting a new line character. Maybe it is just in the question but the ConfigMap's content is the same as in the original config.json. What do you see when the ConfigMap is something totally different? Also, it may be worth trying to use in the Deployment mountPath: /app/wwwroot/config/config.json and add subPath: config.json - this will leave the config directory writeable as ConfigMap volume mounts are read-only.
          – apisim
          Nov 22 '18 at 17:32




          @edbighead - I apparently didn't read thoroughly the whole question and you've provided good level of details. It is a strange behavior. Notice it is probably 16 characters, counting a new line character. Maybe it is just in the question but the ConfigMap's content is the same as in the original config.json. What do you see when the ConfigMap is something totally different? Also, it may be worth trying to use in the Deployment mountPath: /app/wwwroot/config/config.json and add subPath: config.json - this will leave the config directory writeable as ConfigMap volume mounts are read-only.
          – apisim
          Nov 22 '18 at 17:32












          Thanks, specifying subpath resolved the problem. This is still very strange behavior though.
          – edbighead
          Nov 23 '18 at 10:00






          Thanks, specifying subpath resolved the problem. This is still very strange behavior though.
          – edbighead
          Nov 23 '18 at 10:00




















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.





          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


          Please pay close attention to the following guidance:


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53408011%2fmounted-configmap-volume-is-not-served-entirely%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Wiesbaden

          Marschland

          Dieringhausen