Skip to content
This repository has been archived by the owner on Sep 30, 2020. It is now read-only.

Custom settings not available in node pools #346

Closed
ankon opened this issue Feb 23, 2017 · 3 comments · Fixed by #358
Closed

Custom settings not available in node pools #346

ankon opened this issue Feb 23, 2017 · 3 comments · Fixed by #358
Labels
kind/bug Categorizes issue or PR as related to a bug. open for pull request
Milestone

Comments

@ankon
Copy link
Contributor

ankon commented Feb 23, 2017

I'm seeing this error for a template rendered with 0.9.4-rc.3, and a node pool with a change that requires the custom settings:

Error: Failed to initialize cluster driver: failed to load node pool #0: failed to render worker cloud config: template: userdata/cloud-config-worker:389:65: executing "userdata/cloud-config-worker" at <.CustomSettings.work...>: can't evaluate field CustomSettings in type *config.ComputedConfig

Change in the user data:

    - name: swap.service
      command: start
      content: |
        [Unit]
        Description=Turn on swap
        [Service]
        Type=oneshot
        Environment="SWAP_PATH=/var/vm" "SWAP_FILE=swapfile1"
        ExecStartPre=-/usr/bin/rm -rf ${SWAP_PATH}
        ExecStartPre=/usr/bin/mkdir -p ${SWAP_PATH}
        ExecStartPre=/usr/bin/touch ${SWAP_PATH}/${SWAP_FILE}
        ExecStartPre=/bin/bash -c "fallocate -l {{.CustomSettings.workerSwapSize}} ${SWAP_PATH}/${SWAP_FILE}"
        ExecStartPre=/usr/bin/chmod 600 ${SWAP_PATH}/${SWAP_FILE}
        ExecStartPre=/usr/sbin/mkswap ${SWAP_PATH}/${SWAP_FILE}
        ExecStartPre=/usr/sbin/sysctl vm.swappiness=10
        ExecStart=/sbin/swapon ${SWAP_PATH}/${SWAP_FILE}
        ExecStop=/sbin/swapoff ${SWAP_PATH}/${SWAP_FILE}
        ExecStopPost=-/usr/bin/rm -rf ${SWAP_PATH}
        RemainAfterExit=true
        [Install]
        WantedBy=multi-user.target
@redbaron
Copy link
Contributor

not to say that .CustomSettings shouldn't be fixed, but why do you need swap? there is even a flag to enable startup with swap, but description suggests, that starting from version 1.6 kubelet going to refuse to start if it detects that swap is enabled:

 --experimental-fail-swap-on                               Makes the Kubelet fail to start if swap is enabled on the node. This is a temporary option to maintain legacy behavior, failing due to swap enabled will happen by default in v1.6.

@ankon
Copy link
Contributor Author

ankon commented Feb 23, 2017

Interesting. Didn't know that, so that's certainly to be considered.

Why do I need swap: I'm not 100% sure I do, but given the apps I'm running in the cluster I know that they might have quite a bit of "unused" memory (Java ...).

@redbaron
Copy link
Contributor

resources.request.memory is used to schedule, but doesn't limit resource usage. so it can be set smaller than actual usage, which itself is limited by resources.limit.memory.

Actually Java memory is one of the most predictable. from previous experience it was safe to set container limit to Heap size (defined by -Xmx) + 256 MB

@mumoshu mumoshu added this to the v0.9.4-rc.4 milestone Feb 24, 2017
@mumoshu mumoshu added kind/bug Categorizes issue or PR as related to a bug. open for pull request labels Feb 24, 2017
mumoshu added a commit to mumoshu/kube-aws that referenced this issue Feb 27, 2017
kylehodgetts pushed a commit to HotelsDotCom/kube-aws that referenced this issue Mar 27, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/bug Categorizes issue or PR as related to a bug. open for pull request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants