busybox是一個很小的容器 裡面包含了nslookup ping wget 常用的網路命令
apiVersion: v1
kind: Pod
metadata:
name: busybox
namespace: default
spec:
containers:
- name: busybox
image: busybox:1.28.4
command:
- sleep
- "3600"
imagePullPolicy: IfNotPresent
restartPolicy: Always
啟動這個pod
kubectl create -f busybox.yaml
進入容器
kubectl exec -it busybox sh
含curl的busybox
kubectl run --rm -it busybox --image sequenceiq/busybox --restart=Never
然後執行curl測試
tee curl-format.txt <<- 'EOF'
time_namelookup: %{time_namelookup}\n
time_connect: %{time_connect}\n
time_appconnect: %{time_appconnect}\n
time_redirect: %{time_redirect}\n
time_pretransfer: %{time_pretransfer}\n
time_starttransfer: %{time_starttransfer}\n
----------\n
time_total: %{time_total}\n\n
EOF
DOMAIN="www.itnotetk.com"
curl -w '@curl-format.txt' $DOMAIN