Auto-labeling GKE Nodes for XFS support

  • The need to remember to add a XFS node label when creating a new node pool
  • The assumption that ubuntuhas xfsprogs installed
  • The assumption that cos does not have xfsprogs installed. (It doesn’t right now but you never know)

Detecting XFS host support

hostPID: true
volumes:
- name: tmp
emptyDir: {}
initContainers:
- name: detect
image: wardsco/nsenter
command: ["sh", "-eo", "pipefail", "-c"]
args: ["nsenter -t 1 -m -u -i -n -p -- sh -c 'command -v xfs_mkfile' && touch /tmp/xfs_mkfile || true"]
securityContext:
privileged: true
volumeMounts:
- name: tmp
mountPath: /tmp/

Labeling the node for support

initContainers
- name: label
image: wardsco/kubectl:1.11
command: ["sh", "-eo", "pipefail", "-c"]
args: ["kubectl label node --overwrite $NODE_NAME fs.type/xfs=$(test -e /tmp/xfs_mkfile && echo 'true' || echo 'false'"]
env:
- name: NODE_NAME
valueFrom:
fieldRef:
fieldPath: spec.nodeName
volumeMounts:
- name: tmp
mountPath: /tmp/
readOnly: true

Putting it together

The Adventures of Me

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Allan Lei

Allan Lei

The Adventures of Me

More from Medium

Au!tomating — Monitoring & Nodes

Kubernetes configuration

Newsletter of Carlos Santana — Issue #21

Deploy Kafka On Kubernetes In Your Cloud For Free | snapblocs

Helm & Kubernetes | Create Helm Charts