-
Notifications
You must be signed in to change notification settings - Fork 591
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
set mac address to an interface #266
Comments
To configure MAC address, you need:
Could you please change your config and check it again? |
Thanks @s1061123 I will give it a try. |
Hi @wei0313 the question is if the ovs write the mac he assign on a mac filter or something if not yes you can use the tuning. |
@SchSeba judging by the ovs-cni code, it reads mac attribute, but since multus is not setting it so it doesn't reflect. I am wondering if using tuning would help in this matter |
Hi @wei0313 if the ovs knows how to read the mac address you can try to configure the pod this way apiVersion: v1
kind: Pod
metadata:
name: pod-case-01
annotations:
k8s.v1.cni.cncf.io/networks: [{"name": "macvlan-conf-1","mac":"20:01:02:03:04:05"}]
spec:
containers:
- name: pod-case-01
image: docker.io/centos/tools:latest
command:
- /sbin/init If he can't read the mac but he doesn't configure a mac filter you can use tuning like this apiVersion: "k8s.cni.cncf.io/v1"
kind: NetworkAttachmentDefinition
metadata:
name: ovs-conf
spec:
config: '{
"cniVersion": "0.3.1",
"name": "ovs-conf",
"plugins" : [
{
"type": "ovs",
"bridge": "br1",
"vlan": 100
},
{
"type": "tuning"
}
]
}' |
I am experiencing the same issue using the below but please take note of the annotations for When digging into this, it appears that there is no definition for NetworkAttachmentDefinition: apiVersion: "k8s.cni.cncf.io/v1"
kind: NetworkAttachmentDefinition
metadata:
name: macvlan-conf
spec:
config: '{
"cniVersion": "0.3.0",
"plugins": [ {
"type": "macvlan",
"master": "net0",
"mode": "bridge",
"ipam": {
"type": "static"
"addresses": [
{
"address": "192.168.10.30/24",
"gateway": "192.168.10.1"
}
],
"dns": {
"nameservers" : ["8.8.8.8"]
}
}
},
{
"type":"tuning"
}]
}' Pod: apiVersion: v1
kind: Pod
metadata:
name: samplepod
annotations:
k8s.v1.cni.cncf.io/networks: '[
{
"name": "macvlan-conf",
"interfaceRequest": "mgmt", # works
"interface": "mgmt", # doesn't work
"mac": "aa:bb:cc:dd:ee:ff"
}
]'
spec:
containers:
- name: samplepod
command: ["/bin/bash", "-c", "sleep 2000000000000"]
image: dougbtv/centos-network Thanks! |
|
Hi @wei0313 what is the image tag that you use for multus ? |
That could be it, I'm using |
The 'snapshot' will point to master. If you need the latest commit. Please use the snapshot. |
I am using master. I only ran the "cat .images/{multus...flannel...} | kubectl apply -f -" cmd. Should i change to snapshot? I don't see a snapshot branch tho. |
new interface is not getting created , any tips on what could be the issue. |
Looks like this one got fixed by using the latest version (and the |
Hi
I want to have a "fixed" mac-address and my own interface name instead of "net1" for my interface; meaning, which time I redeploy the pod I want the interface to always have the same mac. Below are my original yaml files. I have also tried putting my network-definition under /et/cni/multus/net.d/macvlan-conf.conf and change my network-attachment-definition, but this still doesn't work.
I also tried removing the network-status section and add interfaceRequest: ifname which gives me the interface name I want, but even with macRequest, I am still unable to change the mac-address. I have been googling, and I am unable to find the an example on changing the mac-address. I also looked at code. It seems like delegate.macRequest is always empty string. I traced and found net.macRequest in LoadDelegateNetConf is also empty. When I enable debug log, I could see my mac in setPodNetworkAnnotation.
Is it because delegate is not reading from the pod annotation? Where should I config the delegate?
Does v0.3.1 support macRequest? If so, how should I configure?
If I want my pod yaml / network-attachment-def yaml to handle the configurations only, do i need to change anything in the multus.conf? If so, would you show an example?
Here is my network-attachment-definition yaml.
apiVersion: "k8s.cni.cncf.io/v1" kind: NetworkAttachmentDefinition metadata: name: macvlan-conf spec: config: '{ "cniVersion": "0.3.0", "type": "macvlan", "master": "ens255f1", "mode": "bridge", "ipam": { "type": "host-local", "subnet": "192.168.1.0/24", "rangeStart": "192.168.1.200", "rangeEnd": "192.168.1.216", "routes": [ { "dst": "0.0.0.0/0" } ], "gateway": "192.168.1.1" }, }'
Here is my pod yaml
piVersion: v1 # for versions before 1.9.0 use apps/v1beta2 kind: Pod metadata: name: rhel75-pod annotations: k8s.v1.cni.cncf.io/networks: macvlan-conf k8s.v1.cni.cncf.io/networks-status: '[{ "name": "macvlan-conf", "interface": "agnes-1", "mac": "20:01:02:03:04:05", "ips": [ "192.168.1.200" ], "dns": {} }]' spec: containers: - name: rhel75base image: rhel7.5-base-new:base imagePullPolicy: Never
Thanks in advance
The text was updated successfully, but these errors were encountered: