Dev > CaaS > Kubernetes

Memo on Running curl within a Kubernetes Cluster

Created on Sat Apr 11 2020 • Last Updated on Wed Feb 14 2024N/A Views

🏷️ Kubernetes

For troubleshooting,

nicolaka/netshoot is useful.

kubectl run -it netshoot --image=nicolaka/netshoot --rm --restart=Never --command=true -- bash

Access any Service

curl http://<Service Name>.<Namespace>.svc.cluster.local:<Target Port>

Access the Kubernetes API

curl --cacert /var/run/secrets/kubernetes.io/serviceaccount/ca.crt \
     -H "Authorization: Bearer $(cat /var/run/secrets/kubernetes.io/serviceaccount/token)" \
Found a mistake? Update the entry.