为什么我不能通过端口转发器连接到 pods?
Why can't I connect to pods through the port-forwarder?
更新:
通过安装 socat 解决了这个问题 -
sudo apt-get -y install socat
我正在尝试通过端口转发器从另一个终端连接到 minikube 中的 pod I 运行,但出现一些错误。
我的kubectl版本-
Client Version: version.Info{Major:"1", Minor:"15", GitVersion:"v1.15.3", GitCommit:"2d3c76f9091b6bec110a5e63777c332469e0cba2", GitTreeState:"clean", BuildDate:"2019-08-19T11:13:54Z", GoVersion:"go1.12.9", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"15", GitVersion:"v1.15.2", GitCommit:"f6278300bebbb750328ac16ee6dd3aa7d3549568", GitTreeState:"clean", BuildDate:"2019-08-05T09:15:22Z", GoVersion:"go1.12.5", Compiler:"gc", Platform:"linux/amd64"}
YML文件内容-
apiVersion: v1
kind: Pod
metadata:
name: kubia-manual
spec:
containers:
- image: luksa/kubia
name: kubia
ports:
- containerPort: 8080
protocol: TCP
我运行-
kubectl create -f kubia-manual.yaml
kubectl port-forward kubia-manual 8888:8080
得到了-
Forwarding from 127.0.0.1:8888 -> 8080
Forwarding from [::1]:8888 -> 8080
在我尝试从另一个终端连接到 pod 之后 -
curl localhost:8888
我进入这个终端
curl: (52) Empty reply from server
在第二个终端中,我 运行 我得到的端口转发命令 -
Handling connection for 8888 E1020 14:55:35.817708 7075
portforward.go:400] an error occurred forwarding 8888 -> 8080: error
forwarding port 8080 to pod
253ecb3809333d7dbf7c54831ea12e1eee4f43c3107764ea8ad55f0cad06bc2c, uid
: unable to do port forwarding: socat not found.
我认为根据您的端口转发,您应该尝试在 8888 上连接它
curl localhost:8888
对我有用
最后安装socat解决了 -
sudo apt-get -y install socat
更新:
通过安装 socat 解决了这个问题 -
sudo apt-get -y install socat
我正在尝试通过端口转发器从另一个终端连接到 minikube 中的 pod I 运行,但出现一些错误。
我的kubectl版本-
Client Version: version.Info{Major:"1", Minor:"15", GitVersion:"v1.15.3", GitCommit:"2d3c76f9091b6bec110a5e63777c332469e0cba2", GitTreeState:"clean", BuildDate:"2019-08-19T11:13:54Z", GoVersion:"go1.12.9", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"15", GitVersion:"v1.15.2", GitCommit:"f6278300bebbb750328ac16ee6dd3aa7d3549568", GitTreeState:"clean", BuildDate:"2019-08-05T09:15:22Z", GoVersion:"go1.12.5", Compiler:"gc", Platform:"linux/amd64"}
YML文件内容-
apiVersion: v1
kind: Pod
metadata:
name: kubia-manual
spec:
containers:
- image: luksa/kubia
name: kubia
ports:
- containerPort: 8080
protocol: TCP
我运行-
kubectl create -f kubia-manual.yaml
kubectl port-forward kubia-manual 8888:8080
得到了-
Forwarding from 127.0.0.1:8888 -> 8080
Forwarding from [::1]:8888 -> 8080
在我尝试从另一个终端连接到 pod 之后 -
curl localhost:8888
我进入这个终端
curl: (52) Empty reply from server
在第二个终端中,我 运行 我得到的端口转发命令 -
Handling connection for 8888 E1020 14:55:35.817708 7075 portforward.go:400] an error occurred forwarding 8888 -> 8080: error forwarding port 8080 to pod 253ecb3809333d7dbf7c54831ea12e1eee4f43c3107764ea8ad55f0cad06bc2c, uid : unable to do port forwarding: socat not found.
我认为根据您的端口转发,您应该尝试在 8888 上连接它
curl localhost:8888
对我有用
最后安装socat解决了 -
sudo apt-get -y install socat