This is aside from the actual question (I'm not very familiar with GCE) but:

Be very careful with swap and containers. We found that having swap
available changes the behaviour when a container hits its memory limit –
container memory was being paged out even though the host had free memory;
we actually expected the container to be killed. This does depend on
details of your kernel configuration (both build and boot), and we thought
we had set things up so swap is accounted for in memory limits, but
apparently we were wrong.

If this swapping is what you want, go right ahead, but don't add swap just
because you've always added swap (we did, and it came back to bite us).

/MR

On Thu, Oct 6, 2016 at 8:34 AM June Rhodes <jrho...@redpointgames.com.au>
wrote:

> I used to automatically create and mount a swapfile on Kubernetes nodes at
> startup, however, this doesn't appear to be working anymore on the newer
> GCI images.
>
> The startup script used to do:
>
> fallocate -l 2G /swapfile
> chmod 600 /swapfile
> mkswap /swapfile
> swapon /swapfile
>
> This obviously no longer works because the root partition is now
> read-only, but it doesn't even work if I try and place the swapfile under
> the stateful partition:
>
> fallocate -l 2G /mnt/stateful_partition/swapfile
> chmod 600 /mnt/stateful_partition/swapfile
> mkswap /mnt/stateful_partition/swapfile
> swapon /mnt/stateful_partition/swapfile
>
> Whenever I try and mount a swap file, I just get:
>
> # swapon /mnt/stateful_partition/swapfile
> swapon: /mnt/stateful_partition/swapfile: swapon failed: Invalid argument
>
> Is there a recommended way of mounting a swapfile on Kubernetes nodes at
> startup now?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Kubernetes user discussion and Q&A" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to kubernetes-users+unsubscr...@googlegroups.com.
> To post to this group, send email to kubernetes-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/kubernetes-users.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Kubernetes user discussion and Q&A" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to kubernetes-users+unsubscr...@googlegroups.com.
To post to this group, send email to kubernetes-users@googlegroups.com.
Visit this group at https://groups.google.com/group/kubernetes-users.
For more options, visit https://groups.google.com/d/optout.
  • [kubernetes-use... June Rhodes
    • Re: [kuber... Matthias Rampke
    • [kubernete... 'Aditya Kali' via Kubernetes user discussion and Q&A
      • Re: [k... 'Vishnu Kannan' via Kubernetes user discussion and Q&A
        • Re... Jimmi Dyson
          • ... ravi prasad l r
            • ... Matthias Rampke
              • ... 'Vishnu Kannan' via Kubernetes user discussion and Q&A

Reply via email to