Get available pods in default name space with CURL
Commands used in the demo:
token from the secret
TOKEN=$(kubectl get secrets -o jsonpath="{.items[?(@.metadata.annotations['kubernetes\.io/service-account\.name']=='default')].data.token}"|base64 --decode)
kube-api server ip and CA certificate file
kubectl config view
curl --cacert /root/.minikube/ca.crt --header "Authorization: Bearer $TOKEN" https://172.17.0.43:8443/version
Allow service account view the pods in the default namespace
kubectl create rolebinding default-view --clusterrole=view --serviceaccount=default:default --namespace default
API request to kube-api server endpoint
curl --cacert /root/.minikube/ca.crt --header "Authorization: Bearer $TOKEN" https://172.17.0.43:8443/api/v1/namespaces/default/pods