Skip to content

Instantly share code, notes, and snippets.

@alexeldeib
Created January 14, 2020 18:10
Show Gist options
  • Save alexeldeib/91bf51e45587c179e7c079fc44ca2a8d to your computer and use it in GitHub Desktop.
Save alexeldeib/91bf51e45587c179e7c079fc44ca2a8d to your computer and use it in GitHub Desktop.
privileged pod with access to host modules
apiVersion: apps/v1
kind: Deployment
metadata:
name: &name debug
labels:
app: *name
spec:
replicas: 1
selector:
matchLabels:
app: *name
template:
metadata:
labels:
app: *name
spec:
# nodeSelector:
# node-role.kubernetes.io/master: ''
# tolerations:
# - key: "node-role.kubernetes.io/master" # useful to run on masters to investigate etcd latency
# operator: "Exists"
#
# # above OR below needed ONLY, not both
# #
# affinity:
# nodeAffinity:
# requiredDuringSchedulingIgnoredDuringExecution:
# nodeSelectorTerms:
# - matchExpressions:
# - key: node-role.kubernetes.io/master
# operator: Exists
# affinity:
# podAffinity:
# requiredDuringSchedulingIgnoredDuringExecution:
# - labelSelector:
# matchExpressions:
# - key: app
# operator: In
# values:
# - draft-oms
# topologyKey: "kubernetes.io/hostname"
# certain iotop and bpftrace/bcc tools require hostNetowkr and hostPID
hostNetwork: true
hostPID: true
containers:
- image: ubuntu:18.04
name: ubuntu
command: ["sleep", "infinity"]
resources: {}
securityContext:
privileged: true
volumeMounts:
- mountPath: /lib/modules
name: mod
- mountPath: /usr/src
name: src
- mountPath: /sys
name: sys
volumes:
- hostPath:
path: /lib/modules
type: ""
name: mod
- hostPath:
path: /usr/src
type: ""
name: src
- hostPath:
path: /sys
type: ""
name: sys
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment