kube-static-egress-ip
kube-static-egress-ip copied to clipboard
Failed to get endpoints object for service due to endpoints not found
Following through the instructions on the main README.md, I end up with the following error when trying to apply a new egress rule.
System notes: k8s_kubespray_version = "v2.10.3" k8s_version = "v1.14.3" Networking - Calico
Steps to reproduce:
Follow docs on readme through to the point of customising the staticegressipip
resource. Everything comes up as expected (controllers and gateways are running, until the static egressip resource is applied.
egress object definition:
egress-spec.yaml
apiVersion: staticegressips.nirmata.io/v1alpha1
kind: StaticEgressIP
metadata:
name: test
spec:
rules:
- egressip: 192.168.71.183
service-name: busybox2-busybox
cidr: 192.168.71.204/32
Was running a busybox helm install to test the egress rules
helm install --name busybox-mon jfelten/busybox --namespace kube-system
but have tried adding egress against existing services and getting the same error - have also tried using endpoint address and internal cluster DNS, even though it's specified as service name in the docs, just to check - same error.
I1118 10:35:36.496798 1 main.go:45] Running Nirmata static egress ip controller version:
I1118 10:35:36.498962 1 controller.go:85] Setting up event handlers to handle add/delete/update events to StaticEgressIP resources
I1118 10:35:36.498995 1 controller.go:107] Starting StaticEgressIP controller
I1118 10:35:36.507200 1 controller.go:117] Configured node to act as a egress traffic gateway
I1118 10:35:36.514791 1 controller.go:329] Adding StaticEgressIP: default/test
I1118 10:35:36.515533 1 director.go:87] Node has been setup for static egress IP director functionality successfully.
I1118 10:35:36.515549 1 controller.go:127] Configured node to act as a egress traffic director
I1118 10:35:36.515553 1 controller.go:130] Waiting for informer caches to sync
I1118 10:35:36.615732 1 controller.go:135] Starting workers
I1118 10:35:36.615766 1 controller.go:141] Started workers
I1118 10:35:36.615818 1 controller.go:233] Processing update to StaticEgressIP: default/test
E1118 10:35:36.632545 1 controller.go:274] Failed to get endpoints object for service busybox2-busybox due to endpoints "busybox2-busybox" not found
E1118 10:35:36.632667 1 runtime.go:66] Observed a panic: "invalid memory address or nil pointer dereference" (runtime error: invalid memory address or nil pointer dereference)
/workspace/golang/src/github.com/nirmata/kube-static-egress-ip/vendor/k8s.io/apimachinery/pkg/util/runtime/runtime.go:72
Services in kubectl get services --namespace kube-system
busybox2-busybox ClusterIP 10.233.27.118 <none> 80/TCP 2d18h
coredns ClusterIP 10.233.0.3 <none> 53/UDP,53/TCP,9153/TCP 19d
kubernetes-dashboard ClusterIP 10.233.21.101 <none> 443/TCP 19d
tiller-deploy ClusterIP 10.233.60.188 <none> 44134/TCP 19d
kubectl get endpoints --namespace kube-system
busybox2-busybox 10.233.117.48:80 2d19h
coredns 10.233.64.29:53,10.233.88.10:53,10.233.64.29:53 + 3 more... 19d
kindred-ibis-busybox <none> 2d19h
kube-controller-manager <none> 19d
kube-scheduler <none> 19d
kubernetes-dashboard 10.233.117.11:8443 19d
tiller-deploy 10.233.112.1:44134 19d
Stumbled into the same issue. I suspect there's something wrong with my rules and the controller is missing some variable checking or error handling so it falls down with the whole container.
I ran into the same issue. The StaticEgressIP was loaded into the namespace default, but my service was available in another namespace. Removing the default StaticEgressIP and reloading the StaticEgressIP in the correct namespace solved the problem
Your problem seems to be the same: The logging states that the StaticEgressIP was added to the default namespace (Adding StaticEgressIP: default/test). And you are looking for a service in the kube-system namespace. Delete the default StaticEgressIP and reload it in the kube-system namespace.