[英]How to check the number of workers running inside a docker container of kubernetes pod?
[英]Kubernetes Pod - ssh time out inside docker container
<环境>
本地机(mac Big Sur)
minikube(Darwin 11.4, minikube v1.22.0)
minikube 驱动程序 = hiperkit 掌舵图
气流 1.10.11
亚马逊电子病历
VPN(无代理)
在 Kubernetes Pods 中,Container 无法通过 ssh 连接到远程服务器(在这种情况下为 AWS EMR)
虽然 git-sync 容器可以通过 ssh 进入 github,但静态容器(在这种情况下,气流调度程序)无法使用适当的密钥 ssh 进入 Amazon EMR 服务器。
例如,在 minikube 之外,我本地的 mac 终端能够毫无问题地连接 EMR(每个网络都在 VPN 内,从 172.xxx 开始)
更奇怪的是,在 Amazon EKS(生产)上使用相同的 Kubernetes 环境,在同一个容器(气流调度程序 pod - 气流容器)上没有 ssh 连接问题。 我真的能够在容器 docker bash shell 命令上进行 ssh。
此外,在 minikube 中,curl 命令可以工作,例如 myip.com。 所以只有 ssh 被阻止(我从普通 docker 尝试过,ssh 没有问题)所以,只有 minikube docker 有 SSH 连接问题。
我怀疑端口问题,但在 EKS 上,完全相同的舵图没有 ssh 问题。 只有本地 minikube 失败。
我分享我的日志,我将不胜感激任何答案。 谢谢。
-我的容器路由表
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
0.0.0.0 172.17.0.1 0.0.0.0 UG 0 0 0 eth0
172.17.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth0
airflow@airflow-test-scheduler-76869c5546-svnnk:/opt/airflow/dags$ netstat -anp |grep 22
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
tcp 0 0 172.17.0.2:49228 10.109.98.113:5432 TIME_WAIT -
tcp 0 0 172.17.0.2:36148 52.78.231.108:22 TIME_WAIT -
unix 2 [ ACC ] STREAM LISTENING 152204 69/airflow schedule /tmp/pymp-6zqm69hn/listener-uqwa_n0n
unix 3 [ ] STREAM CONNECTED 152208 61/airflow schedule /tmp/pymp-gieffrz0/listener-s8z5z1_k
airflow@airflow-test-scheduler-76869c5546-svnnk:/opt/airflow/dags$ ssh -v -i emr-pa.pem hadoop@ip-xxx-xx-x-xxx.ap-northeast-2.compute.internal
OpenSSH_7.9p1 Debian-10+deb10u2, OpenSSL 1.1.1d 10 Sep 2019
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to ip-xxx-xxx-xxx-xxx.ap-northeast-2.compute.internal [xxx.xxx.xxx.xxx] port 22.
debug1: connect to address xxx.xxx.xxx.xxx port 22: Connection timed out
ssh: connect to host ip-xxx-xxx-xxx-xxx.ap-northeast-2.compute.internal port 22: Connection timed out
经过一番研究,我为主机和我的 minikube 集群尝试了 nmap。 这是来自 nmap 的报告
Starting Nmap 7.70 ( https://nmap.org ) at 2021-07-23 11:06 UTC
Nmap scan report for host.minikube.internal (192.168.64.1)
Host is up (0.00021s latency).
PORT STATE SERVICE
22/tcp closed ssh
Nmap scan report for 192-168-64-2.kubernetes.default.svc.cluster.local (192.168.64.2)
Host is up (0.036s latency).
PORT STATE SERVICE
22/tcp open ssh
Nmap done: 256 IP addresses (2 hosts up) scanned in 112.09 seconds
Nmap scan report for ip-xxx-xxx-x-xxx.ap-northeast-2.compute.internal (172.24.4.254)
Host is up.
All 1000 scanned ports on ip-xxx-xxx-x-xxx.ap-northeast-2.compute.internal (xxx.xxx.x.xxx) are filtered
我找到了另一个来解决这个问题。 如果您使用minikube start --driver=docker
而不是--driver=hyperkit
那么 ssh 端口自然会打开。 我仍然无法找到为什么“hyperkit”通过 Kubernetes VM 阻止了ssh
,但这可能是原因之一。
这个: https : //github.com/kubernetes/minikube/issues/8162和这个: https : //minikube.sigs.k8s.io/docs/handbook/vpn_and_proxy/#possible-workarounds
更改--dirver=docker
模式时,不要忘记在Kubernetes enable
上打开Kubernetes enable
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.