Skip to content

Instantly share code, notes, and snippets.

@fabiand
Last active December 20, 2023 11:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fabiand/6d4e0e624c9839483694e9ae05852776 to your computer and use it in GitHub Desktop.
Save fabiand/6d4e0e624c9839483694e9ae05852776 to your computer and use it in GitHub Desktop.
explicit swap
# "Explicit swap"
# The user can explicitly request swap
kind: Pod
spec:
resources
requests:
# This assumes separate resources for mem and swap
# Set by user
memory: 2G
# Set by user
node.kubernetes.io/swap: 2G
---
# "Virtual memory"
# Builds on “explicit swap”
# The user can request virtual-memory, the system will split this into memory and swap resources
# The user can also still explicitly request swap
kind: Pod
spec:
resources
requests:
# This assumes a virtual resource for swap and memory which is split into mem+swap by a webhook
# Set by user: Give me 4GB of virtual memory, you manage it for me
node.kubernetes.io/virtual-memory: 4G
# Computed by system: swap according to ratio (in this example 50/50)
node.kubernetes.io/swap: 2G
# Computed by system: memory according to ratio (in this example 50/50)
memory: 2G
---
# Implicit/Transparent swap
kind: Pod
spec:
resources
requests:
# This assumes node.mem.cap = ram + swap. this would not allow to differentiate anymore
# Set by user
memory: 4G
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment