-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Exposing new BPF failed: invalid LXC MAC: invalid MAC address #14100
Comments
@ArthurChiao did you miss some outputs? The text that you have written in the PR description says "it will raise the above errors." but I don't understand which errors you are referring to. |
Sorry, "the above errors" means the title Full error messages look like this:
|
Thanks for the report @ArthurChiao! |
@ArthurChiao Could you detail how you specified the list of security-relevant labels? I'm unable to reproduce with our |
All my previous tests were based on $ ls
bpf-ct-global-any-max clustermesh-config enable-health-checking enable-node-port k8s-kubeconfig-path masquerade sidecar-istio-proxy-image
bpf-ct-global-tcp-max cluster-name enable-hubble flannel-manage-existing-containers kube-proxy-replacement monitor-aggregation tofqdns-enable-poller
clean-cilium-bpf-state custom-cni-conf enable-ipv4 flannel-master-device kvstore policy-audit-mode tunnel
clean-cilium-state debug enable-ipv6 flannel-uninstall-on-exit kvstore-opt preallocate-bpf-maps wait-bpf-mount
cluster-id enable-endpoint-health-checking enable-legacy-services identity-allocation-mode labels prometheus-serve-addr
# workable label list
$ cat labels
reserved:.* k8s:!io.cilium.k8s.namespace.labels.* k8s:io.cilium.k8s.policy k8s:app k8s:name [our-specific-labels] # broken label list
$ cat labels
k8s:!io.cilium.k8s.namespace.labels.* k8s:io.cilium.k8s.policy k8s:app k8s:name [our-specific-labels] where, |
Fix cilium#14100 Identity relevant labels is a label prefix list combined of two parts: 1. base part: 1.1. Read from a user specified (--label-prefix-file) json file if this file is provided. Default: `--label-prefix-file=""`. 1.2 If `--label-prefix-file=""`, read from a default hardcoded list (`func defaultLabelPrefixCfg()`). 2. additional part: read from user inputs (--labels), default `--labels=""` When `--label-prefix-file=""` (default) but `--labels=<custom-list>` provided, if `reserved:host` (or `reserved:.*`) is not included in the above `<custom-list>`, the `cilium_host` endpoint will lose its `reserved:host` label. When rolling back to the default configuration, that is, setting `--labels=""` and restarting the agent, cilium agent will raise errors like following: ``` level=warning msg="Regeneration of endpoint failed" .. error="Exposing new BPF failed: invalid LXC MAC: invalid MAC address " level=error msg="endpoint regeneration failed" .. error="Exposing new BPF failed: invalid LXC MAC: invalid MAC address " ``` And subsequently, all pods' traffic on this node will be interrupted. This is because the agent relies on this label to distinguish `cilium_host` endpoint from normal endpoints, and the former has no `lxcMAC`. We should never exclude reserved labels from default label list. Add reserved labels to the default label list could solve the problem. Appendix: Sample custom label file (--label-prefix-file) to overwrite the default base label list: ``` { "version": 1, "valid-prefixes": [ { "source": "k8s", "prefix": "io.kubernetes.pod.namespace" }, { "source": "k8s", "prefix": ":io.cilium.k8s.namespace.labels" }, { "source": "k8s", "prefix": "app.kubernetes.io" },{ "source": "k8s", "prefix": "k8s!:io.kubernetes" },{ "source": "k8s", "prefix": "!kubernetes.io" },{ "source": "k8s", "prefix": "!.*beta.kubernetes.io" },{ "source": "k8s", "prefix": "!k8s.io" },{ "source": "k8s", "prefix": "!pod-template-generation" },{ "source": "k8s", "prefix": "!pod-template-hash" },{ "source": "k8s", "prefix": "!controller-revision-hash" },{ "source": "k8s", "prefix": "!annotation.*" },{ "source": "k8s", "prefix": "!etcd_node" ] } ``` Signed-off-by: ArthurChiao <arthurchiao@hotmail.com>
Fix #14100 Identity relevant labels is a label prefix list combined of two parts: 1. base part: 1.1. Read from a user specified (--label-prefix-file) json file if this file is provided. Default: `--label-prefix-file=""`. 1.2 If `--label-prefix-file=""`, read from a default hardcoded list (`func defaultLabelPrefixCfg()`). 2. additional part: read from user inputs (--labels), default `--labels=""` When `--label-prefix-file=""` (default) but `--labels=<custom-list>` provided, if `reserved:host` (or `reserved:.*`) is not included in the above `<custom-list>`, the `cilium_host` endpoint will lose its `reserved:host` label. When rolling back to the default configuration, that is, setting `--labels=""` and restarting the agent, cilium agent will raise errors like following: ``` level=warning msg="Regeneration of endpoint failed" .. error="Exposing new BPF failed: invalid LXC MAC: invalid MAC address " level=error msg="endpoint regeneration failed" .. error="Exposing new BPF failed: invalid LXC MAC: invalid MAC address " ``` And subsequently, all pods' traffic on this node will be interrupted. This is because the agent relies on this label to distinguish `cilium_host` endpoint from normal endpoints, and the former has no `lxcMAC`. We should never exclude reserved labels from default label list. Add reserved labels to the default label list could solve the problem. Appendix: Sample custom label file (--label-prefix-file) to overwrite the default base label list: ``` { "version": 1, "valid-prefixes": [ { "source": "k8s", "prefix": "io.kubernetes.pod.namespace" }, { "source": "k8s", "prefix": ":io.cilium.k8s.namespace.labels" }, { "source": "k8s", "prefix": "app.kubernetes.io" },{ "source": "k8s", "prefix": "k8s!:io.kubernetes" },{ "source": "k8s", "prefix": "!kubernetes.io" },{ "source": "k8s", "prefix": "!.*beta.kubernetes.io" },{ "source": "k8s", "prefix": "!k8s.io" },{ "source": "k8s", "prefix": "!pod-template-generation" },{ "source": "k8s", "prefix": "!pod-template-hash" },{ "source": "k8s", "prefix": "!controller-revision-hash" },{ "source": "k8s", "prefix": "!annotation.*" },{ "source": "k8s", "prefix": "!etcd_node" ] } ``` Signed-off-by: ArthurChiao <arthurchiao@hotmail.com>
[ upstream commit 16e8f2f ] Fix #14100 Identity relevant labels is a label prefix list combined of two parts: 1. base part: 1.1. Read from a user specified (--label-prefix-file) json file if this file is provided. Default: `--label-prefix-file=""`. 1.2 If `--label-prefix-file=""`, read from a default hardcoded list (`func defaultLabelPrefixCfg()`). 2. additional part: read from user inputs (--labels), default `--labels=""` When `--label-prefix-file=""` (default) but `--labels=<custom-list>` provided, if `reserved:host` (or `reserved:.*`) is not included in the above `<custom-list>`, the `cilium_host` endpoint will lose its `reserved:host` label. When rolling back to the default configuration, that is, setting `--labels=""` and restarting the agent, cilium agent will raise errors like following: ``` level=warning msg="Regeneration of endpoint failed" .. error="Exposing new BPF failed: invalid LXC MAC: invalid MAC address " level=error msg="endpoint regeneration failed" .. error="Exposing new BPF failed: invalid LXC MAC: invalid MAC address " ``` And subsequently, all pods' traffic on this node will be interrupted. This is because the agent relies on this label to distinguish `cilium_host` endpoint from normal endpoints, and the former has no `lxcMAC`. We should never exclude reserved labels from default label list. Add reserved labels to the default label list could solve the problem. Appendix: Sample custom label file (--label-prefix-file) to overwrite the default base label list: ``` { "version": 1, "valid-prefixes": [ { "source": "k8s", "prefix": "io.kubernetes.pod.namespace" }, { "source": "k8s", "prefix": ":io.cilium.k8s.namespace.labels" }, { "source": "k8s", "prefix": "app.kubernetes.io" },{ "source": "k8s", "prefix": "k8s!:io.kubernetes" },{ "source": "k8s", "prefix": "!kubernetes.io" },{ "source": "k8s", "prefix": "!.*beta.kubernetes.io" },{ "source": "k8s", "prefix": "!k8s.io" },{ "source": "k8s", "prefix": "!pod-template-generation" },{ "source": "k8s", "prefix": "!pod-template-hash" },{ "source": "k8s", "prefix": "!controller-revision-hash" },{ "source": "k8s", "prefix": "!annotation.*" },{ "source": "k8s", "prefix": "!etcd_node" ] } ``` Signed-off-by: ArthurChiao <arthurchiao@hotmail.com> Signed-off-by: Michi Mutsuzaki <michi@isovalent.com>
[ upstream commit 16e8f2f ] Fix #14100 Identity relevant labels is a label prefix list combined of two parts: 1. base part: 1.1. Read from a user specified (--label-prefix-file) json file if this file is provided. Default: `--label-prefix-file=""`. 1.2 If `--label-prefix-file=""`, read from a default hardcoded list (`func defaultLabelPrefixCfg()`). 2. additional part: read from user inputs (--labels), default `--labels=""` When `--label-prefix-file=""` (default) but `--labels=<custom-list>` provided, if `reserved:host` (or `reserved:.*`) is not included in the above `<custom-list>`, the `cilium_host` endpoint will lose its `reserved:host` label. When rolling back to the default configuration, that is, setting `--labels=""` and restarting the agent, cilium agent will raise errors like following: ``` level=warning msg="Regeneration of endpoint failed" .. error="Exposing new BPF failed: invalid LXC MAC: invalid MAC address " level=error msg="endpoint regeneration failed" .. error="Exposing new BPF failed: invalid LXC MAC: invalid MAC address " ``` And subsequently, all pods' traffic on this node will be interrupted. This is because the agent relies on this label to distinguish `cilium_host` endpoint from normal endpoints, and the former has no `lxcMAC`. We should never exclude reserved labels from default label list. Add reserved labels to the default label list could solve the problem. Appendix: Sample custom label file (--label-prefix-file) to overwrite the default base label list: ``` { "version": 1, "valid-prefixes": [ { "source": "k8s", "prefix": "io.kubernetes.pod.namespace" }, { "source": "k8s", "prefix": ":io.cilium.k8s.namespace.labels" }, { "source": "k8s", "prefix": "app.kubernetes.io" },{ "source": "k8s", "prefix": "k8s!:io.kubernetes" },{ "source": "k8s", "prefix": "!kubernetes.io" },{ "source": "k8s", "prefix": "!.*beta.kubernetes.io" },{ "source": "k8s", "prefix": "!k8s.io" },{ "source": "k8s", "prefix": "!pod-template-generation" },{ "source": "k8s", "prefix": "!pod-template-hash" },{ "source": "k8s", "prefix": "!controller-revision-hash" },{ "source": "k8s", "prefix": "!annotation.*" },{ "source": "k8s", "prefix": "!etcd_node" ] } ``` Signed-off-by: ArthurChiao <arthurchiao@hotmail.com> Signed-off-by: Paul Chaignon <paul@cilium.io>
[ upstream commit 16e8f2f ] Fix #14100 Identity relevant labels is a label prefix list combined of two parts: 1. base part: 1.1. Read from a user specified (--label-prefix-file) json file if this file is provided. Default: `--label-prefix-file=""`. 1.2 If `--label-prefix-file=""`, read from a default hardcoded list (`func defaultLabelPrefixCfg()`). 2. additional part: read from user inputs (--labels), default `--labels=""` When `--label-prefix-file=""` (default) but `--labels=<custom-list>` provided, if `reserved:host` (or `reserved:.*`) is not included in the above `<custom-list>`, the `cilium_host` endpoint will lose its `reserved:host` label. When rolling back to the default configuration, that is, setting `--labels=""` and restarting the agent, cilium agent will raise errors like following: ``` level=warning msg="Regeneration of endpoint failed" .. error="Exposing new BPF failed: invalid LXC MAC: invalid MAC address " level=error msg="endpoint regeneration failed" .. error="Exposing new BPF failed: invalid LXC MAC: invalid MAC address " ``` And subsequently, all pods' traffic on this node will be interrupted. This is because the agent relies on this label to distinguish `cilium_host` endpoint from normal endpoints, and the former has no `lxcMAC`. We should never exclude reserved labels from default label list. Add reserved labels to the default label list could solve the problem. Appendix: Sample custom label file (--label-prefix-file) to overwrite the default base label list: ``` { "version": 1, "valid-prefixes": [ { "source": "k8s", "prefix": "io.kubernetes.pod.namespace" }, { "source": "k8s", "prefix": ":io.cilium.k8s.namespace.labels" }, { "source": "k8s", "prefix": "app.kubernetes.io" },{ "source": "k8s", "prefix": "k8s!:io.kubernetes" },{ "source": "k8s", "prefix": "!kubernetes.io" },{ "source": "k8s", "prefix": "!.*beta.kubernetes.io" },{ "source": "k8s", "prefix": "!k8s.io" },{ "source": "k8s", "prefix": "!pod-template-generation" },{ "source": "k8s", "prefix": "!pod-template-hash" },{ "source": "k8s", "prefix": "!controller-revision-hash" },{ "source": "k8s", "prefix": "!annotation.*" },{ "source": "k8s", "prefix": "!etcd_node" ] } ``` Signed-off-by: ArthurChiao <arthurchiao@hotmail.com> Signed-off-by: Michi Mutsuzaki <michi@isovalent.com>
[ upstream commit 16e8f2f ] Fix #14100 Identity relevant labels is a label prefix list combined of two parts: 1. base part: 1.1. Read from a user specified (--label-prefix-file) json file if this file is provided. Default: `--label-prefix-file=""`. 1.2 If `--label-prefix-file=""`, read from a default hardcoded list (`func defaultLabelPrefixCfg()`). 2. additional part: read from user inputs (--labels), default `--labels=""` When `--label-prefix-file=""` (default) but `--labels=<custom-list>` provided, if `reserved:host` (or `reserved:.*`) is not included in the above `<custom-list>`, the `cilium_host` endpoint will lose its `reserved:host` label. When rolling back to the default configuration, that is, setting `--labels=""` and restarting the agent, cilium agent will raise errors like following: ``` level=warning msg="Regeneration of endpoint failed" .. error="Exposing new BPF failed: invalid LXC MAC: invalid MAC address " level=error msg="endpoint regeneration failed" .. error="Exposing new BPF failed: invalid LXC MAC: invalid MAC address " ``` And subsequently, all pods' traffic on this node will be interrupted. This is because the agent relies on this label to distinguish `cilium_host` endpoint from normal endpoints, and the former has no `lxcMAC`. We should never exclude reserved labels from default label list. Add reserved labels to the default label list could solve the problem. Appendix: Sample custom label file (--label-prefix-file) to overwrite the default base label list: ``` { "version": 1, "valid-prefixes": [ { "source": "k8s", "prefix": "io.kubernetes.pod.namespace" }, { "source": "k8s", "prefix": ":io.cilium.k8s.namespace.labels" }, { "source": "k8s", "prefix": "app.kubernetes.io" },{ "source": "k8s", "prefix": "k8s!:io.kubernetes" },{ "source": "k8s", "prefix": "!kubernetes.io" },{ "source": "k8s", "prefix": "!.*beta.kubernetes.io" },{ "source": "k8s", "prefix": "!k8s.io" },{ "source": "k8s", "prefix": "!pod-template-generation" },{ "source": "k8s", "prefix": "!pod-template-hash" },{ "source": "k8s", "prefix": "!controller-revision-hash" },{ "source": "k8s", "prefix": "!annotation.*" },{ "source": "k8s", "prefix": "!etcd_node" ] } ``` Signed-off-by: ArthurChiao <arthurchiao@hotmail.com> Signed-off-by: Paul Chaignon <paul@cilium.io>
Caused by security-relevant-labels configuration changes. Not sure if this is the expected behavior, or a bug.
General Information
Dig inside
According to https://docs.cilium.io/en/v1.8/operations/scalability/identity-relevant-labels/#configuring-identity-relevant-labels,
after specifying a security relevant label list to cilium agent and restart the agent, all endpoints on this node will be regenerated with the given labels + default labels.
One problem is that, if
reserved:.host
(orreserved:.*
) is not included in the provided label list, thecilium_host
endpoint will losereserved:host
label. This is ok for now.But when rolling back the change, that is, removing the specified label list and restarting the agent, it will raise the above errors.
Note that subsequently, all pods' traffic on this node will be interrupted.
My understanding is that
IsHost()
returnsfalse
forcilium_host
endpoint during this case: https://github.com/cilium/cilium/blob/master/pkg/endpoint/bpf.go#L629In the next, it will treat this endpoint as a normal endpoint, and try to get its
lxcMAC
, then failed ascilium_host
has no correspondinglxcMAC
.Try-outs
Quickly tested that follow two ways could avoid the problem:
reserved:host
(orreserved:.*
) to the custom label list.reserved:host
(orreserved:.*
) to the (hard-coded) default label list, and re-compile cilium agent, https://github.com/cilium/cilium/blob/master/pkg/labelsfilter/filter.go#L163Thanks!
@joestringer
The text was updated successfully, but these errors were encountered: