尝试从 GKE pod 运行 ping,错误:ping:套接字:不允许操作

问题描述 投票:0回答:1

尝试使用命令:kubectl run --rm utils -it --image arunvelsriram/utils bash运行基于

此图像
的一次性容器,该容器有效,但当我尝试 ping 时,我得到:

ping google.com
ping: socket: Operation not permitted

对此提到的一些解决方案尝试运行:

setcap cap_net_raw=ep $(which ping)

但随后我收到错误:

bash: setcap: command not found
如果我尝试安装它,我会不断遇到此错误:

E: Could not open lock file /var/lib/dpkg/lock-frontend - open (13: Permission denied)
E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), are you root?

是否有任何图像允许我从 GKE 中的 kubernetes pod 执行 ping 操作?

kubernetes networking google-kubernetes-engine ping
1个回答
0
投票

我尝试运行这个,它工作得很好,看看你的集群是否有任何额外的限制,它会降低 Linux 功能

kubectl run --rm utils -it --image arunvelsriram/utils bash
If you don't see a command prompt, try pressing enter.
utils@utils:~$ ping google.com
PING google.com (209.85.202.102) 56(84) bytes of data.
64 bytes from dg-in-f102.1e100.net (209.85.202.102): icmp_seq=1 ttl=101 time=1.45 ms
^C
--- google.com ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 1.457/1.457/1.457/0.000 ms
utils@utils:~$ 
© www.soinside.com 2019 - 2024. All rights reserved.