Skip to content

Instantly share code, notes, and snippets.

@uablrek
Created May 7, 2020 08:50
Show Gist options
  • Save uablrek/471566d25197b8db28b28cdc8bf97a8d to your computer and use it in GitHub Desktop.
Save uablrek/471566d25197b8db28b28cdc8bf97a8d to your computer and use it in GitHub Desktop.
K8s POD with lots of iptools loaded in hostNetwork as a DaemonSet
apiVersion: v1
kind: ServiceAccount
metadata:
name: mserver
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: mserver
rules:
- apiGroups:
- ""
resources:
- namespaces
- pods
- services
- nodes
- endpoints
verbs:
- list
- get
- watch
---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: mserver
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: mserver
subjects:
- kind: ServiceAccount
name: mserver
namespace: default
---
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: mserver-daemonset
spec:
selector:
matchLabels:
app: mserver
template:
metadata:
labels:
app: mserver
spec:
hostNetwork: true
serviceAccountName: mserver
serviceAccount: mserver
containers:
- name: mserver
image: registry.nordix.org/cloud-native/mserver:latest
ports:
- containerPort: 5001
securityContext:
capabilities:
add: ["NET_ADMIN"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment