Kops: Swap memory on nodes

Created on 22 Aug 2017  路  7Comments  路  Source: kubernetes/kops

We're running a kops created cluster for our dev environment. The cluster obviously does not need to be extremely performant. Unfortunately our service still require loads of memory to start up. Is it possible to ask nodes to configure swap space also on bootup?

Most helpful comment

@gauravarora use cloudinit

  additionalUserData:
  - name: swap.txt
    type: text/cloud-config
    content: |
      #cloud-config
      swap:
        filename: /swapfile
        size: 8589934592

All 7 comments

Running swap with docker can be super problematic. Can you use spot instances instead to save $$?

To answer your question you can probably use a hook container to set swap, but u need another Ebs volume as well ;(

@chrislovecnm we're already using spot instance but 8-10 spot instances can add up quickly. This is a dev environment used maybe for 8 hours a day so spot was a no brainer.

Would you happen to have an example of how swap can be used via a hook container?

@gauravarora use cloudinit

  additionalUserData:
  - name: swap.txt
    type: text/cloud-config
    content: |
      #cloud-config
      swap:
        filename: /swapfile
        size: 8589934592

@gauravarora can we close this issue?

Yes.

I tried the response by @thuandt, but it didn't create any swap space.
swapon command is not available in master nodes Debian v8,
free command shows swap as total 0, used 0, free 0

There is no /swapfile in / directory

Am I missing something?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rot26 picture rot26  路  5Comments

chrislovecnm picture chrislovecnm  路  3Comments

thejsj picture thejsj  路  4Comments

chrislovecnm picture chrislovecnm  路  3Comments

olalonde picture olalonde  路  4Comments