Skip to content

Add alerts for TLS/DNS/Auth/RateLimit policies not targeting Gateways… #514

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 3, 2024

Conversation

david-martin
Copy link
Member

@david-martin david-martin commented Apr 2, 2024

… and HTTPRoutes

Closes #440

To verify:

  • Bring up a local cluster as per https://docs.kuadrant.io/getting-started-single-cluster/, using the release-v0.6.2 branch by specifying export KUADRANT_REF=release-v0.6.2
  • Bring up an observability stack using these commands from this PR branch
    • ./bin/kustomize build ./config/observability/| docker run --rm -i ryane/kfilt -i kind=CustomResourceDefinition | kubectl apply --server-side -f -
    • ./bin/kustomize build ./config/observability/| docker run --rm -i ryane/kfilt -x kind=CustomResourceDefinition | kubectl apply -f -
  • Import the example PrometheusRules resource with the alerting rules
    • kubectl apply -f ./examples/alerts/prometheusrules_policies_missing.yaml
  • Create example Gateways, HTTPRotues and policies to verify the alerts behave as expected. It isn't important that the Gateways, HTTPRoutes & policies are actually working, just that they exist in etcd
    • kubectl apply -f https://gist.githubusercontent.com/david-martin/991d76255d90b51860f9ed8724f43983/raw/cc8196e9b9088895054f6f9556929ae10f36554c/alerting_resources.yaml
  • Access the Prometheus Alerts tab by using port-forwarding and verify the following alerts are firing
    • kubectl -n monitoring port-forward service/prometheus-k8s 9090:9090
    • open http://127.0.0.1:9090 > Alerts tab
    • There should be a total of 8 Gateway/HTTPRoutes alerts firing (It will take a few minutes for metrics to all be scraped and the pending state to switch to firing). You can check the summary text for each, or run this query from the Graph tab and compare: ALERTS{alertstate="firing",alertname=~"Gateway.*|HTTPRoute.*"}
ALERTS{alertname="GatewayWithoutDnsPolicy", alertstate="firing", container="kube-rbac-proxy-main", customresource_group="gateway.networking.k8s.io", customresource_kind="Gateway", customresource_version="v1beta1", gateway_name="testgw3", gatewayclass_name="test", instance="10.244.0.31:8443", job="kube-state-metrics", name="testgw3", namespace="default", severity="warning"}
1
ALERTS{alertname="GatewayWithoutDnsPolicy", alertstate="firing", container="kube-rbac-proxy-main", customresource_group="gateway.networking.k8s.io", customresource_kind="Gateway", customresource_version="v1beta1", gateway_name="testgw4", gatewayclass_name="test", instance="10.244.0.31:8443", job="kube-state-metrics", name="testgw4", namespace="default", severity="warning"}
1
ALERTS{alertname="GatewayWithoutTlsPolicy", alertstate="firing", container="kube-rbac-proxy-main", customresource_group="gateway.networking.k8s.io", customresource_kind="Gateway", customresource_version="v1beta1", gateway_name="testgw1", gatewayclass_name="test", instance="10.244.0.31:8443", job="kube-state-metrics", name="testgw1", namespace="default", severity="warning"}
1
ALERTS{alertname="GatewayWithoutTlsPolicy", alertstate="firing", container="kube-rbac-proxy-main", customresource_group="gateway.networking.k8s.io", customresource_kind="Gateway", customresource_version="v1beta1", gateway_name="testgw4", gatewayclass_name="test", instance="10.244.0.31:8443", job="kube-state-metrics", name="testgw4", namespace="default", severity="warning"}
1
ALERTS{alertname="HTTPRouteWithoutAuthPolicy", alertstate="firing", container="kube-rbac-proxy-main", customresource_group="gateway.networking.k8s.io", customresource_kind="HTTPRoute", customresource_version="v1beta1", httproute_name="testhttproute1", instance="10.244.0.31:8443", job="kube-state-metrics", name="testhttproute1", namespace="default", severity="warning"}
1
ALERTS{alertname="HTTPRouteWithoutAuthPolicy", alertstate="firing", container="kube-rbac-proxy-main", customresource_group="gateway.networking.k8s.io", customresource_kind="HTTPRoute", customresource_version="v1beta1", httproute_name="testhttproute4", instance="10.244.0.31:8443", job="kube-state-metrics", name="testhttproute4", namespace="default", severity="warning"}
1
ALERTS{alertname="HTTPRouteWithoutRateLimitPolicy", alertstate="firing", container="kube-rbac-proxy-main", customresource_group="gateway.networking.k8s.io", customresource_kind="HTTPRoute", customresource_version="v1beta1", httproute_name="testhttproute3", instance="10.244.0.31:8443", job="kube-state-metrics", name="testhttproute3", namespace="default", severity="warning"}
1
ALERTS{alertname="HTTPRouteWithoutRateLimitPolicy", alertstate="firing", container="kube-rbac-proxy-main", customresource_group="gateway.networking.k8s.io", customresource_kind="HTTPRoute", customresource_version="v1beta1", httproute_name="testhttproute4", instance="10.244.0.31:8443", job="kube-state-metrics", name="testhttproute4", namespace="default", severity="warning"}

@david-martin david-martin requested a review from a team as a code owner April 2, 2024 10:06
@R-Lawton R-Lawton merged commit a10c9af into Kuadrant:main Apr 3, 2024
14 checks passed
philbrookes pushed a commit that referenced this pull request Apr 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create example Alerts for when a Gateway or HTTPRoute is not protected by Kuadrant Polices
3 participants