Hi Dimitris,
On 2022-10-12 12:19, Dimitris Koumantos wrote:
> Hi Andrew,
>
> Thank you for the quick reply.
> I've installed cryostat helm chart and as I can see from the cyostat's pod,
> this is the image used: `
quay.io/cryostat/cryostat:2.1.1` .
> So I guess I am using cryostat v2.1.1.
>
> My matching expression is inspired by your article
> <
https://developers.redhat.com/articles/2021/11/09/automating-jdk-flight-recorder-containers#use_case_2__custom_monitoring_with_kubernetes_labels_or_annotations> and is like this:
>
> ```
> target.annotations.platform['jfr'] == 'enabled'
> ```
>
> If I create a new rule with the same matching expression the newly
> created pod is matched.
> Either way, I can see the custom annotation in the newly created pod's
> description, so yes I am sure the new pod should match the expression.
>
> Please find attached the logs of the main container you requested.
>
> Best,
> Dimitris.
>
Excellent, thanks for all of that information. Your match expression and
use of annotations makes good sense.
In your container logs I see what I believe to be the root cause:
```
Exception in thread "main"
io.fabric8.kubernetes.client.KubernetesClientException: Failed to start
websocket
```
Cryostat 2.1.1 uses a k8s API query to populate the full list of target
applications, so when you open the Cryostat web UI this issues a `GET
/api/v1/targets` Cryostat API request which becomes a k8s API query. So,
this is how you're able to see your new pods appearing.
But Cryostat also uses a k8s watcher to listen for changes and detect
when target applications come and go. The WebSocket exception above
indicates that this watcher connection failed, so Cryostat isn't
receiving any of these async notifications from the k8s API server.
Unfortunately, this also means that some of Cryostat's internal
machinery that depends on these async notifications won't work -
including the rule processing that triggers rule activation against new
target applications. This same mechanism enables async updates of the
UI, so with the breakage you're experiencing I would expect that the UI
does not auto-update when you redeploy your applications?
In Cryostat 2.2 [0] I have done some work in this area [1] which
improves the reliability of that connection to the k8s API server and
unifies the data model between queries and async updates. This might
help in your case, too, though it's curious that the connection fails to
begin with. I don't know what could be causing the Watcher WebSocket to
fail with "No route to host", while the later queries to the same API
server apparently succeed.
[0] expected GA: November 15th. If you want to try out an upstream
preview build for your PoC before that date please just ask for help
setting that up, but be aware that this would be an unsupported upstream
community preview build
[1]
https://github.com/cryostatio/cryostat/pull/1037