![](/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.