我有一个 http 应用程序,它侦听端口 3000(我得到一条检查运行状况的路由)。 我公开了 dockerfile 3000 端口。 我用
helm create
创建了一个舵图
我唯一修改的是服务和测试。
在服务中,我将端口设置为 443(我的入口需要),将 targetPort 设置为 3000。
进入测试 Pod,我也修改了端口:
containers:
- name: wget
image: busybox
command: ['wget']
args: ['mysvc:443']
restartPolicy: Never
但是在 CI (GHA) 期间通过
https://github.com/helm/chart-testing获得
Connecting to mysvc:443 (10.96.235.205:443) wget: can't connect to remote host (10.96.235.205): Connection refused
我可以看到我的应用程序日志,并且探针也可以工作(在 3000 上) 我不明白出了什么问题。
谢谢
更新:添加 mysvc 定义
apiVersion: v1
kind: Service
metadata:
name: mysvc
labels:
{{- include "mysvc_chart.labels" . | nindent 4 }}
spec:
type: clusterIP
ports:
- port: 443
targetPort: http
protocol: TCP
name: http
- port: 50051
targetPort: grpc
protocol: TCP
name: grpc
- port: 21
targetPort: ftp
protocol: TCP
name: ftp
- port: 3001
targetPort: metrics
protocol: TCP
name: metrics
selector:
{{- include "mysvc_chart.selectorLabels" . | nindent 4 }}
更新2:使用nmap,我可以看到
443/tcp closed https```
我部署的端口错误 -----