Skip to content

Instantly share code, notes, and snippets.

@vfarcic
Created December 14, 2019 17:11
Show Gist options
  • Save vfarcic/30da210bd55f16673af6fddaa3f5e4aa to your computer and use it in GitHub Desktop.
Save vfarcic/30da210bd55f16673af6fddaa3f5e4aa to your computer and use it in GitHub Desktop.
cd k8s-specs
git pull
GD5_ADDR=go-demo-5.$LB_IP.nip.io
kubectl create namespace go-demo-5
helm install go-demo-5 \
https://github.com/vfarcic/go-demo-5/releases/download/0.0.1/go-demo-5-0.0.1.tgz \
--namespace go-demo-5 \
--set ingress.host=$GD5_ADDR
kubectl -n go-demo-5 \
rollout status \
deployment go-demo-5
curl http://$GD5_ADDR/demo/hello
for i in {1..20}; do
DELAY=$[ $RANDOM % 10000 ]
curl "http://$GD5_ADDR/demo/hello?delay=$DELAY"
done
open "http://$PROM_ADDR/alerts"
# Prometheus expression
# sum(rate(
# nginx_ingress_controller_request_duration_seconds_sum{
# ingress="go-demo-5"
# }[5m]
# )) /
# sum(rate(
# nginx_ingress_controller_request_duration_seconds_count{
# ingress="go-demo-5"
# }[5m]
# ))
open "https://github.com/vfarcic/go-demo-5/blob/master/main.go"
kubectl -n metrics \
run -it test \
--image=appropriate/curl \
--restart=Never \
--rm \
-- go-demo-5.go-demo-5:8080/metrics
open "http://$PROM_ADDR/targets"
open "http://$PROM_ADDR/graph"
# Prometheus expression
# http_server_resp_time_count
# Prometheus expression
# http_server_resp_time_sum{
# kubernetes_name="go-demo-5"
# } /
# http_server_resp_time_count{
# kubernetes_name="go-demo-5"
# }
for i in {1..20}; do
DELAY=$[ $RANDOM % 10000 ]
curl "http://$GD5_ADDR/demo/hello?delay=$DELAY"
done
open "http://$PROM_ADDR/alerts"
# Prometheus expression
# sum(rate(
# http_server_resp_time_bucket{
# le="0.1",
# kubernetes_name="go-demo-5"
# }[5m]
# )) /
# sum(rate(
# http_server_resp_time_count{
# kubernetes_name="go-demo-5"
# }[5m]
# ))
# Prometheus expression
# sum(rate(
# http_server_resp_time_bucket{
# le="0.1",
# kubernetes_name="go-demo-5"
# }[5m]
# ))
# by (method, path) /
# sum(rate(
# http_server_resp_time_count{
# kubernetes_name="go-demo-5"
# }[5m]
# ))
# by (method, path)
# Prometheus expression
# sum(rate(
# http_server_resp_time_bucket{
# le="0.1",
# kubernetes_name="go-demo-5"
# }[5m]
# ))
# by (method, path) /
# sum(rate(
# http_server_resp_time_count{
# kubernetes_name="go-demo-5"
# }[5m]
# ))
# by (method, path) < 0.99
helm delete go-demo-5 \
--namespace go-demo-5
kubectl delete ns go-demo-5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment