client-go连接阿里云服务器失败

来源:3-8 Golang后端项目搭建-集成K8S(下)

重开之Java程序员

2024-06-15

老师你好,我租了一台阿里云轻量级云服务器,然后用client-go去连接访问,但是报错

kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
networking:
  # WARNING: It is _strongly_ recommended that you keep this the default
  # (127.0.0.1) for security reasons. However it is possible to change this.
  apiServerAddress: "172.24.61.141"
  # By default the API server listens on a random open port.
  # You may choose a specific port but probably don't need to in most cases.
  # Using a random port makes it easier to spin up multiple clusters.
  apiServerPort: 6443

containerdConfigPatches:
- |-
  [plugins."io.containerd.grpc.v1.cri".registry.mirrors."docker.io"]
    endpoint = ["https://njzb6yez.mirror.aliyuncs.com"]
nodes:
- role: control-plane
- role: worker
- role: worker
Get "https://172.24.61.141:6443/api/v1/pods": dial tcp 172.24.61.141:6443: connectex: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.

172.24.61.141是我的私人ip,我在防火墙也开启了6443端口
图片描述
但是我用我自己创建的Ubuntu就可以,这是为什么

写回答

1回答

暮闲

2024-06-15

阿里云服务器需要去安全组开启6443端口哦

0
1
重开之Java程序员
老师你看我截的图,我开启了
2024-06-15
共1条回复

Kubernetes系统精讲 Go语言实战K8S集群可视化

核心知识+高阶应用+原理剖析+二次开发 全方位打通K8S生产实践

399 学习 · 265 问题

查看课程