---
apiVersion: "k8s.cni.cncf.io/v1"
kind: NetworkAttachmentDefinition
metadata:
name: centos-runtimeconfig-def
spec:
config: '{
"cniVersion": "0.3.1",
"name": "aioexample",
"plugins": [{
"type": "bridge",
"bridge": "cnitest0",
"name": "testbridge",
"ipam": {
"type": "static"
}
}, {
"capabilities": { "mac": true, "ips": true },
"type": "tuning"
}]
}'
---
apiVersion: v1
kind: Pod
metadata:
name: staticippod
annotations:
k8s.v1.cni.cncf.io/networks: '[
{
"name": "centos-runtimeconfig-def",
"ips": [ "192.168.2.205/24" ],
"mac": "CA:FE:C0:FF:EE:00"
}
]'
spec:
containers:
- name: staticippod
command: ["/bin/ash", "-c", "trap : TERM INT; sleep infinity & wait"]
image: alpine
net-attach-def used:
apiVersion: "k8s.cni.cncf.io/v1"
kind: NetworkAttachmentDefinition
metadata:
name: centos-runtimeconfig-def
spec:
config: '{
"cniVersion": "0.3.1",
"plugins": [{
"type": "macvlan",
"capabilities": { "ips": true },
"master": "eth0",
"mode": "bridge",
"ipam": {
"type": "static"
}
}, {
"capabilities": { "mac": true },
"type": "tuning"
}]
}'
pod spec used:
apiVersion: v1
kind: Pod
metadata:
name: samplepod
annotations:
k8s.v1.cni.cncf.io/networks: '[
{
"name": "centos-runtimeconfig-def",
"ips": [ "192.168.2.205/24" ],
"mac": "CA:FE:C0:FF:EE:00"
}
]'
spec:
containers:
- name: samplepod
command: ["/bin/bash", "-c", "trap : TERM INT; sleep infinity & wait"]
image: dougbtv/centos-network