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

dynamo3209_188769 avatar image
dynamo3209_188769 asked ·

Installing datasource for Grafana in week 5 exercise fails with "no matches for kind GrafanaDataSource in version integreatly.org/v1alpha1"

Hi,

I am getting below error in 4b of week 5 exercise, while installing datasource for grafana

$ kubectl -n cass-operator create -f ./prometheus_grafana/grafana/datasource.yaml
error: unable to recognize "./prometheus_grafana/grafana/datasource.yaml": no matches for kind "GrafanaDataSource" in version "integreatly.org/v1alpha1"

Please help in resolving the issue.

Thanks,

Mohit

[UPDATE] The grafana operator is running however, not seen in watch output.

I have a corei5 8gb laptop with Ubuntu running.

$ kubectl -n cass-operator create -f ./prometheus_grafana/grafana/operator.yaml
Error from server (AlreadyExists): error when creating "./prometheus_grafana/grafana/operator.yaml": subscriptions.operators.coreos.com "grafana-operator" already exists
$ watch kubectl -n cass-operator get pods
NAME                                  READY   STATUS    RESTARTS   AGE
cass-operator-56fcb9ff47-nblkx        1/1     Running   6          5d17h
prometheus-default-0                  3/3     Running   4          3d1h
prometheus-operator-cc5458b99-9plvd   1/1     Running   4          3d1h
$ kubectl -n cass-operator create -f ./prometheus_grafana/grafana/datasource.yaml
error: unable to recognize "./prometheus_grafana/grafana/datasource.yaml": no matches for kind "GrafanaDataSource" in version "integreatly.org/v1alpha1"
workshopgrafana
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 ·

The Grafana operator takes a long time to start so just be patient. :)

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 datasource.yaml 
error: unable to recognize "datasource.yaml": no matches for kind "GrafanaDataSource" in version "integreatly.org/v1alpha1"

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 nearly 20 minutes for the Grafana 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
grafana-operator-68495d6676-9tdxk     1/1     Running   0          94s
prometheus-default-0                  3/3     Running   1          90m
prometheus-operator-cc5458b99-tbgx6   1/1     Running   0          104m

Once it was ready, I was able to create the datasource successfully:

$ kubectl -n cass-operator apply -f datasource.yaml 
grafanadatasource.integreatly.org/prometheus-grafanadatasource created

and I can now see the metrics service listening on port 8080:

$ kubectl -n cass-operator get svc
NAME                       TYPE        CLUSTER-IP     EXTERNAL-IP   PORT(S)    AGE
grafana-operator-metrics   ClusterIP   10.99.126.98   <none>        8080/TCP   5m49s
prometheus-operated        ClusterIP   None           <none>        9090/TCP   95m

Once you get to this point, you should be able to install the dashboards. Cheers!

2 comments 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.

Hi Eric,

Thanks for the detailed explanation.

[Update posted in original question above]

0 Likes 0 · ·
The grafana operator is running however, not seen in watch output.

@dynamo3209_188769 The Grafana operator is not running which is why you cannot see it in the get pods output.

The kubectl create command is not an "installation operation". It's an abstraction by Kubernetes which does a lot more than that in the background. It pulls the image down to your machine, installs it, and runs it. Just because you ran the command doesn't mean that Kubernetes has finished doing the work in the background.

Until the operator shows as running in the get pods output, you will not be able to create a datasource.

In my experience, trying to do this on an 8GB machine is challenging. We recommend you run in on a machine with at least 16GB. Cheers!

0 Likes 0 · ·