Skip to content

Latest commit

 

History

History
15 lines (15 loc) · 585 Bytes

README.md

File metadata and controls

15 lines (15 loc) · 585 Bytes

PodUseCurl

Create a Pod let curl command be used in a Pod to retrieve all Pods in the default namespace Use the following command to create the Pod in Kubernetes cluster:

kubectl apply -f curl-pod.yaml

After the Pod is created, use the following command to execute pod:

kubectl exec -it curl-pod -- /bin/sh

Use the curl command to retrieve all pod in default namespace:

curl -k -H "Authorization: Bearer $(cat /var/run/secrets/kubernetes.io/serviceaccount/token)" \
     https://kubernetes.default.svc.cluster.local/api/v1/namespaces/default/pods