Creating a VLAN with OVS CNI - gpillon/k4all GitHub Wiki
To configure a VLAN, you first need to create a NetworkAttachmentDefinition that specifies the network details. Here is an example (you can paste directy in the Kubernetes dashboard):
apiVersion: "k8s.cni.cncf.io/v1"
kind: NetworkAttachmentDefinition
metadata:
namespace: default
name: ovs-net-vlan100
spec:
config: '{
"cniVersion": "0.3.1",
"type": "ovs",
"bridge": "ovs-bridge",
"vlan": 100,
"ipam": {
"type": "static",
"addresses": [
{
"address": "192.168.10.42/24",
"gateway": "192.168.10.42"
}]
}
}'
Save this YAML as ovs-vlan100.yaml and apply it to your cluster with kubectl apply -f ovs-vlan100.yaml.