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
pkg/k8s: detect k8s mode if env variable K8S_NODE_NAME is set #11021
Conversation
Since the k8s service is only created after the container is started, kubelet is not fast enough to set `KUBERNETES_SERVICE_HOST` nor `KUBERNETES_SERVICE_PORT` in a container which can result in Cilium having non-expected behaviors such as: panicking upon initialization; use an autogenerated IPv4 allocated IP as Cilium won't detect which podCIDR the k8s node has set; Re-allocate cilium_host router IP address which can cause network disruption; Inability to restore endpoints since their IP do not belong to the autogenerated CIDR. As all Cilium DaemonSets have the K8S_NODE_NAME environment variable set we can detect if Cilium is running in k8s mode by also checking if this flag is set and not depend on `KUBERNETES_SERVICE_HOST` nor `KUBERNETES_SERVICE_PORT` for this detection. More info: kubernetes/kubernetes#40973 Signed-off-by: André Martins <andre@cilium.io>
test-me-please |
This broke the dev VM for developers not running k8s there like @jrajahalme and I, fix will be out soon. |
@joestringer @jrajahalme |
…t k8s We've seen panics where it seems k8s isn't setup correctly but CRD related operations occur, and segfault. This occurs when the kubernetes service is not ready by the time cilium starts up and so cilium misses the KUBERNETES_SERVICE_{HOST,PORT} settings resulting in it being misconfigured. See kubernetes/kubernetes#40973 See cilium#11021 Signed-off-by: Ray Bejjani <ray@isovalent.com>
We unconditionally write the hostname into the sysconfig file, for example |
…t k8s We've seen panics where it seems k8s isn't setup correctly but CRD related operations occur, and segfault. This occurs when the kubernetes service is not ready by the time cilium starts up and so cilium misses the KUBERNETES_SERVICE_{HOST,PORT} settings resulting in it being misconfigured. See kubernetes/kubernetes#40973 See #11021 Signed-off-by: Ray Bejjani <ray@isovalent.com>
Fixes: #11021 Signed-off-by: Jarno Rajahalme <jarno@covalent.io>
Fixes: #11021 Signed-off-by: Jarno Rajahalme <jarno@covalent.io>
…t k8s [ upstream commit 1598f74 ] We've seen panics where it seems k8s isn't setup correctly but CRD related operations occur, and segfault. This occurs when the kubernetes service is not ready by the time cilium starts up and so cilium misses the KUBERNETES_SERVICE_{HOST,PORT} settings resulting in it being misconfigured. See kubernetes/kubernetes#40973 See #11021 Signed-off-by: Ray Bejjani <ray@isovalent.com> Signed-off-by: John Fastabend <john.fastabend@gmail.com>
…t k8s [ upstream commit 1598f74 ] We've seen panics where it seems k8s isn't setup correctly but CRD related operations occur, and segfault. This occurs when the kubernetes service is not ready by the time cilium starts up and so cilium misses the KUBERNETES_SERVICE_{HOST,PORT} settings resulting in it being misconfigured. See kubernetes/kubernetes#40973 See #11021 Signed-off-by: Ray Bejjani <ray@isovalent.com> Signed-off-by: John Fastabend <john.fastabend@gmail.com>
…t k8s [ upstream commit 1598f74 ] We've seen panics where it seems k8s isn't setup correctly but CRD related operations occur, and segfault. This occurs when the kubernetes service is not ready by the time cilium starts up and so cilium misses the KUBERNETES_SERVICE_{HOST,PORT} settings resulting in it being misconfigured. See kubernetes/kubernetes#40973 See #11021 Signed-off-by: Ray Bejjani <ray@isovalent.com> Signed-off-by: John Fastabend <john.fastabend@gmail.com>
…t k8s [ upstream commit 1598f74 ] We've seen panics where it seems k8s isn't setup correctly but CRD related operations occur, and segfault. This occurs when the kubernetes service is not ready by the time cilium starts up and so cilium misses the KUBERNETES_SERVICE_{HOST,PORT} settings resulting in it being misconfigured. See kubernetes/kubernetes#40973 See #11021 Signed-off-by: Ray Bejjani <ray@isovalent.com> Signed-off-by: Chris Tarazi <chris@isovalent.com>
…t k8s [ upstream commit 1598f74 ] We've seen panics where it seems k8s isn't setup correctly but CRD related operations occur, and segfault. This occurs when the kubernetes service is not ready by the time cilium starts up and so cilium misses the KUBERNETES_SERVICE_{HOST,PORT} settings resulting in it being misconfigured. See kubernetes/kubernetes#40973 See #11021 Signed-off-by: Ray Bejjani <ray@isovalent.com> Signed-off-by: Chris Tarazi <chris@isovalent.com>
Since the k8s service is only created after the container is started,
kubelet is not fast enough to set
KUBERNETES_SERVICE_HOST
norKUBERNETES_SERVICE_PORT
in a container which can result in Ciliumhaving non-expected behaviors such as: panicking upon initialization; use
an autogenerated IPv4 allocated IP as Cilium won't detect which podCIDR
the k8s node has set; Re-allocate cilium_host router IP address which
can cause network disruption; Inability to restore endpoints since their
IP do not belong to the autogenerated CIDR.
As all Cilium DaemonSets have the K8S_NODE_NAME environment variable set
we can detect if Cilium is running in k8s mode by also checking if this
flag is set and not depend on
KUBERNETES_SERVICE_HOST
norKUBERNETES_SERVICE_PORT
for this detection.More info: kubernetes/kubernetes#40973
Signed-off-by: André Martins andre@cilium.io