Skip to content

Instantly share code, notes, and snippets.

@janeczku
Last active July 12, 2022 16:45
Show Gist options
  • Save janeczku/660ca5f436c1cde22619c7dde57796f2 to your computer and use it in GitHub Desktop.
Save janeczku/660ca5f436c1cde22619c7dde57796f2 to your computer and use it in GitHub Desktop.
Configure multicast-compatible macvlan interfaces with Multus
apiVersion: apps/v1
kind: Deployment
metadata:
name: test
spec:
replicas: 1
selector:
matchLabels:
app: test
template:
metadata:
annotations:
k8s.v1.cni.cncf.io/networks: '[
{ "name": "macvlan-test",
"ips": [ "10.1.1.101/24" ],
"mac": "c2:b0:57:49:47:f1",
"gateway": [ "10.1.1.1" ]
}]'
labels:
app: test
spec:
containers:
- name: test
command: ["/bin/sleep","3650d"]
image: ubuntu
securityContext:
capabilities:
add: ["NET_ADMIN", "SYS_TIME","NET_RAW"]
apiVersion: "k8s.cni.cncf.io/v1"
kind: NetworkAttachmentDefinition
metadata:
name: macvlan-test
spec:
config: '{
"cniVersion": "0.3.1",
"plugins": [
{
"type": "macvlan",
"capabilities": { "ips": true },
"master": "eth0",
## mode (string, optional): one of “bridge”, “private”, “vepa”, “passthru”
"mode": "passthru",
"ipam": {
"type": "static",
"routes": [
{
"dst": "240.0.0.0/4"
}
]
}
}, {
"capabilities": { "mac": true },
"type": "tuning"
}
]
}'
---
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment