Last active
April 24, 2019 08:39
-
-
Save s1061123/bdbd74a2f6df4f6ab61091abca327810 to your computer and use it in GitHub Desktop.
cni-route-overwrite examples
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#only available with crio/podman (not docker runtime) | |
--- | |
apiVersion: "k8s.cni.cncf.io/v1" | |
kind: NetworkAttachmentDefinition | |
metadata: | |
name: flannel-cluster | |
namespace: kube-system | |
spec: | |
config: ' | |
{ | |
"cniVersion": "0.4.0", | |
"name": "cbr0", | |
"plugins": [ | |
{ | |
"type": "flannel", | |
"delegate": { | |
"hairpinMode": true, | |
"isDefaultGateway": true | |
} | |
}, | |
{ | |
"type": "route-overwrite", | |
"flushgateway": false | |
}, | |
{ | |
"type": "portmap", | |
"capabilities": { | |
"portMappings": true | |
} | |
} | |
] | |
}' | |
--- | |
apiVersion: "k8s.cni.cncf.io/v1" | |
kind: NetworkAttachmentDefinition | |
metadata: | |
name: vlan-eth1 | |
spec: | |
config: '{ | |
"cniVersion": "0.3.0", | |
"name": "test", | |
"plugins": [ | |
{ | |
"type": "vlan", | |
"master": "eth1", | |
"vlanId": 1, | |
"ipam": { | |
"type": "static", | |
"addresses": [ { "address": "172.16.1.10/24" } ] | |
} | |
}, | |
{ | |
"type": "route-overwrite", | |
"addroutes": [ { "dst": "0.0.0.0/0", "gw": "172.16.1.1" }] | |
}] | |
}' | |
--- | |
apiVersion: v1 | |
kind: Pod | |
metadata: | |
name: pod-case-01 | |
annotations: | |
k8s.v1.cni.cncf.io/networks: '[ | |
{ "name": "vlan-eth1" | |
} | |
]' | |
spec: | |
containers: | |
- name: pod-case-01 | |
image: docker.io/centos/tools:latest | |
command: | |
- /sbin/init |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment