Scrape apiserver metrics

Pulls raw Prometheus metrics from the apiserver, no monitoring stack needed

kubectl get --raw /metrics | grep apiserver_request_total

tool
kubectl73 commands
tags
kubectlmetricsobservabilityperformance

More kubectl commands

  • kubectl get --raw '/healthz/etcd?verbose'

    Checks etcd connectivity through the apiserver health endpoint

  • kubectl get --raw '/apis/metrics.k8s.io/v1beta1/nodes' | jq '.items[] | {name:.metadata.name, cpu:.usage.cpu, mem:.usage.memory}'

    Raw node usage from the metrics API, without kubectl top formatting

  • kubectl debug <pod> -n <ns> --copy-to=<pod>-dbg --share-processes --image=nicolaka/netshoot -- sleep infinity

    Creates a copy of the pod with a debug container in a shared PID namespace; the original pod is not touched

  • kubectl explain deploy.spec --recursive | less

    Prints the full tree of nested fields; great for finding valid field names

  • kubectl rollout pause deploy/<name> -n <ns>; kubectl rollout resume deploy/<name> -n <ns>

    Make several edits without a rollout for each one, then resume to apply them all at once

all 73 kubectl commands