Build Cloud-Native apps with Apache Cassandra

GOT QUESTIONS from the Workshop? You're in the right place! Post a question here and we'll get you answers.

Click here for Week 8 Materials and Homework.

Follow us on Eventbrite to get notified when new workshops are scheduled!


question

chandrasekar.b03_190734 avatar image
chandrasekar.b03_190734 asked ·

Still getting error: unable to recognize "instance.yaml": no matches for kind "Prometheus" in version "monitoring.coreos.com/v1"

After many troubleshooting, i have come up to the step for creating prometheus operator. After creating the operator, as told in README.MD,, i waited for about 10 to 15 minutes for the operator to initialize. then proceeding to the next command,

kubectl -n cass-operator apply -f ./prometheus_grafana/prometheus/instance.yaml

i encountered this error. i even tried after 10 minute of interval but the error still persists.

serviceaccount/prometheus unchanged
clusterrole.rbac.authorization.k8s.io/prometheus unchanged
clusterrolebinding.rbac.authorization.k8s.io/prometheus unchanged
error: unable to recognize "./prometheus_grafana/prometheus/instance.yaml": no matches for kind "Prometheus" in version "monitoring.coreos.com/v1"

How could i solve the error ?

Note: i have used one Kind master and only on worker due to my system memory (8 GB RAM). My cass-operator is also running properly. I'm connected to the internet anyways.

Any help would be appreciable :)

workshopprometheus
10 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

1 Answer

Erick Ramirez avatar image
Erick Ramirez answered ·

Unfortunately, the Prometheus operator takes a long time to start and you just have to wait.

I can replicate your problem in a new k8s cluster I built from scratch. If the operator is not ready, I get the same error:

$ kubectl -n cass-operator apply -f instance.yaml 
serviceaccount/prometheus unchanged
clusterrole.rbac.authorization.k8s.io/prometheus unchanged
clusterrolebinding.rbac.authorization.k8s.io/prometheus unchanged
error: unable to recognize "instance.yaml": no matches for kind "Prometheus" in version "monitoring.coreos.com/v1"

I have a relatively big machine with 8 CPUs and 32GB of RAM with nothing else running on it but Kubernetes. In my case, it took 50 minutes for the Prometheus operator to be ready.

I recommend you watch it with the following command:

$ watch kubectl -n cass-operator get pods

You will know it is ready when you see something similar to this:

NAME                                  READY   STATUS    RESTARTS   AGE
prometheus-operator-cc5458b99-tbgx6   1/1     Running   0          13m

Once it was ready, I was able to create an instance successfully:

$ kubectl -n cass-operator apply -f instance.yaml 
serviceaccount/prometheus unchanged
clusterrole.rbac.authorization.k8s.io/prometheus unchanged
clusterrolebinding.rbac.authorization.k8s.io/prometheus unchanged
prometheus.monitoring.coreos.com/default created

So now I have Prometheus running in a pod:

$ kubectl -n cass-operator get pods
NAME                                  READY   STATUS    RESTARTS   AGE
prometheus-default-0                  3/3     Running   1          6m52s
prometheus-operator-cc5458b99-tbgx6   1/1     Running   0          20m

with a service listening on port 9090:

$ kubectl -n cass-operator get svc
NAME                  TYPE        CLUSTER-IP   EXTERNAL-IP   PORT(S)    AGE
prometheus-operated   ClusterIP   None         <none>        9090/TCP   8m12s

Be patient and it will happen. Cheers!

1 comment Share
10 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

[Follow up question posted in #7419]

0 Likes 0 · ·