![](/img/trans.png)
[英]Gloo gateway-proxy External IP on GKE : telnet: Unable to connect to remote host: Connection refused
[英]telnet: Unable to connect to remote host: Connection refused - running from a kubernetes pod
我的本地 kube.netes 集群由 Rancher Desktop 运行 -
% kubectl cluster-info
Kubernetes control plane is running at https://127.0.0.1:6443
CoreDNS is running at https://127.0.0.1:6443/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy
Metrics-server is running at https://127.0.0.1:6443/api/v1/namespaces/kube-system/services/https:metrics-server:https/proxy
我创建了一个非常基本的工作——在localhost
和端口6443
上执行te.net
并查看集群中运行的作业 pod 是否可以访问该连接 ->
apiVersion: batch/v1
kind: Job
metadata:
name: telnet-test
spec:
template:
spec:
containers:
- name: test-container
image: getting-started:latest
imagePullPolicy: IfNotPresent
command: ["/usr/bin/telnet"]
args: ["127.0.0.1","6443"]
restartPolicy: Never
backoffLimit: 4
Docker image也很基本,安装te.net
->
#Download base image ubuntu 16.04
FROM ubuntu:16.04
# Update Software repository
RUN apt update && apt upgrade
# Install nginx, php-fpm and supervisord from ubuntu repository
RUN apt install -y telnet
CMD ["which","telnet"]
EXPOSE 6443
当我运行这项工作时,连接被拒绝 ->
telnet: Unable to connect to remote host: Connection refused
Trying 127.0.0.1...
知道我在这里可能会遗漏什么吗?
“kubectl cluster-info”显示您的 Kube.netes api-server 在哪个节点和端口上运行。 所以这些是在虚拟机或物理机上运行的进程。
IP 地址127.0.0.1 也称为本地主机地址,属于local.network 适配器。 因此,它不是您可以从任何其他机器调用的真正的 IP。
当您在作为 Pod 运行或使用“docker run”运行的容器映像中测试 127.0.0.1:6443 时,您并不是在尝试调用端口 6443 上的节点。而是尝试在容器内部的端口 6443 上调用本地主机地址.
安装 Kube.netes 时,最好将集群地址配置为:6443 或:6443,而不是使用 localhost 地址。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.