Last active
April 21, 2022 13:33
-
-
Save amcginlay/8fb9c64bf26a4771e6fa6bc27c21ac3c to your computer and use it in GitHub Desktop.
kubectl-raw.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# when you pass the "--debug" flag to the AWS CLI you can see which endpoint is being invoked. | |
# you can do something similar with kubectl when you pass the "-v6" flag as follows. | |
# documentation here: https://kubernetes.io/docs/reference/kubectl/cheatsheet/#kubectl-output-verbosity-and-debugging | |
kubectl get nodes -v6 | |
# the opening lines of the response reveal the endpoint | |
# strip out the hostname and pass what remains to kubectl as follows to see the original response which was previously prettified for you | |
kubectl get --raw /api/v1/nodes | |
# more examples as follows ... | |
kubectl get namespaces -v6 | |
kubectl get --raw /api/v1/namespaces | |
kubectl -n demos get pods -v6 | |
kubectl get --raw /api/v1/namespaces/demos/pods | |
kubectl -n demos get services -v6 | |
kubectl get --raw /api/v1/namespaces/demos/services | |
# the following option shows the use of query strings, jq and highlighted search terms using both grep and less | |
kubectl cluster-info -v6 | |
kubectl get --raw /api/v1/namespaces/kube-system/services?labelSelector=kubernetes.io%2Fcluster-service%3Dtrue | jq . | |
kubectl get --raw /api/v1/namespaces/kube-system/services?labelSelector=kubernetes.io%2Fcluster-service%3Dtrue | jq . | grep "amazonaws\|$" --color | |
kubectl get --raw /api/v1/namespaces/kube-system/services?labelSelector=kubernetes.io%2Fcluster-service%3Dtrue | jq . | less -p amazonaws | |
# and the classic metrics option, which returns control plane metrics in prometheus format | |
kubectl get --raw /metrics |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment