Operator panicking because cache isn't filled
I'm trying to launch an operator made through the operator sdk to my kubernetes cluster. When I attach to the pod created by the operator deployment, I get the following logs and then the pod crashes:
Defaulting container name to splunk-operator.
Use 'kubectl describe pod/splunk-operator-594bf7f68b-mvjr6 -n default' to see all of the containers in this pod.
If you don't see a command prompt, try pressing enter.
ERROR: logging before flag.Parse: E1012 17:06:27.137241 1 memcache.go:138] couldn't get current server API group list; will keep using cached value. (Get https://10.96.0.1:443/api?timeout=32s: dial tcp 10.96.0.1:443: i/o timeout)
time="2018-10-12T17:06:27Z" level=error msg="failed to create service for operator metrics: failed to get resource client: failed to get resource type: failed to get the resource REST mapping for GroupVersionKind(/v1, Kind=Service): the cache has not been filled yet"
time="2018-10-12T17:06:27Z" level=info msg="Watching splunk-instance.splunk.com/v1alpha1, SplunkInstance, default, 5000000000"
time="2018-10-12T17:06:27Z" level=error msg="failed to get resource client for (apiVersion:splunk-instance.splunk.com/v1alpha1, kind:SplunkInstance, ns:default): failed to get resource type: failed to get the resource REST mapping for GroupVersionKind(splunk-instance.splunk.com/v1alpha1, Kind=SplunkInstance): the cache has not been filled yet"
panic: failed to get resource type: failed to get the resource REST mapping for GroupVersionKind(splunk-instance.splunk.com/v1alpha1, Kind=SplunkInstance): the cache has not been filled yet
goroutine 1 [running]:
operator/splunk-operator/vendor/github.com/operator-framework/operator-sdk/pkg/sdk.Watch(0x1188c3f, 0x23, 0x11744a5, 0xe, 0xc000040010, 0x7, 0x12a05f200, 0x0, 0x0, 0x0)
/Users/tmalik/go/src/operator/splunk-operator/vendor/github.com/operator-framework/operator-sdk/pkg/sdk/api.go:49 +0x49a
main.main()
/Users/tmalik/go/src/operator/splunk-operator/cmd/splunk-operator/main.go:36 +0x292
The same operator works on my local machine when using Minikube but doesn't work
@talham7391 Did you create the needed RBAC for the operator as well?
@LiliC Yes, I'm using the RBAC that operator-sdk generates for you.
@talham7391 You mentioned it works locally on minikube, but not on your k8s cluster, is it a GKE cluster?
@LiliC Nope, I am using docker UCP. After some investigation I'm finding that it may be the cluster that was causing the problem. Is there any way to enable verbose logging for what the operator sdk is doing so that I can further debug the issue?
@talham7391 The built operator does more or less what any other application running in your cluster does plus accesses the k8s api. So maybe make sure networking works and that the operator has the permissions in your cluster. But that does make sense that the issue might be in the cluster itself. Let me know if you have any other questions!
There is already an issue and discussion for adding more verbose logging https://github.com/operator-framework/operator-sdk/issues/503 Hopefully we will tackle that soon. :)
@LiliC Great! Thanks a lot
@talham7391 No problem! Feel free to reopen the issue if you run into the problems once the cluster is working!