Cannot ping to any host from kubenetes pod.

Needed functionality: Ping between 2 kubernetes pods Expected result: Successful ping between 2 pods.

Current output: pod/kube-server-rtt-3 created pod/kube-client-rtt-3 created pod/kube-server-rtt-3 condition met pod/kube-client-rtt-3 condition met command terminated with exit code 1 Kubernetes RTT benchmark-3 done

@kube:~/Documents$ cat kubeIperf3_RTT_3.txt PING ( 56(84) bytes of data.

--- ping statistics --- 5 packets transmitted, 0 received, 100% packet loss, time 4103ms

Used docker image: https://hub.docker.com/repository/docker/arnedh/dockerbench/general

The script :

kubectl run kube-server-rtt-$i --image=$image --restart=Never --overrides='{"spec": {"tolerations": [{"key": "node-role.kubernetes.io/control-plane", "operator": "Exists", "effect": "NoSchedule"}], "containers": [{"name": "kube-server-rtt-'$i'", "image": "'$image'", "command": ["/bin/sh", "-c", "sleep infinity"], "securityContext": {"capabilities": {"add": ["NET_RAW"]}}}]}}' kubectl run kube-client-rtt-$i --image=$image --restart=Never --overrides='{"spec": {"tolerations": [{"key": "node-role.kubernetes.io/control-plane", "operator": "Exists", "effect": "NoSchedule"}], "containers": [{"name": "kube-client-rtt-'$i'", "image": "'$image'", "command": ["/bin/sh", "-c", "sleep infinity"], "securityContext": {"capabilities": {"add": ["NET_RAW"]}}}]}}'

Wait for the pods to be ready kubectl wait --for=condition=ready pod/kube-server-rtt-$i --timeout=600s kubectl wait --for=condition=ready pod/kube-client-rtt-$i --timeout=600s

Get the needed IP address of the server serverIP= #$(kubectl get pod kube-server-rtt-$i -o=jsonpath='{.status.podIP}')

Perform RTT test kubectl exec kube-client-rtt-$i -- ping -c 5 $serverIP > kubeIperf3_RTT_$i.txt echo "Kubernetes RTT benchmark-$i done"

Remove the pods kubectl delete pod kube-server-rtt-$i kubectl delete pod kube-client-rtt-$i

Thanks in advance!

(default namespace, no limits on ping functionality)


You must log in to answer this question.

Browse other questions tagged .