【发布时间】:2021-09-30 18:10:14
【问题描述】:
大家好,我正在尝试访问运行 fastapi 应用程序的 kubernetes 服务并一直拒绝此连接,这里的任何见解都会有所帮助,提前致谢
curl -X POST "https://file-monitoring-ms.default.svc.cluster.local:8000/api/v1/filemonitor/" -H "accept: application/json" -H "Content-Type: application/json"
-d "{}"
我也尝试了 file-monitoring-ms.default.svc.cluster.local:8000/api/v1/filemonitor/,因为没有 https 的端点相同的连接被拒绝
app.include_router(filesmonitor, prefix='/api/v1/filemonitor', tags=['filemonitor'])
...
...
@filesmonitor.post("/", status_code=201)
async def getSqsEvent
kind: Deployment
metadata:
labels:
app: file-monitoring-ms
name: file-monitoring-ms
spec:
replicas: 1
template:
metadata:
labels:
app: file-monitoring-ms
spec:
containers:
- name: file-monitoring-ms
imagePullPolicy: Never
image: file-monitoring-image:latest
ports:
- containerPort: 8000
protocol: TCP
selector:
matchLabels:
app: file-monitoring-ms
---
apiVersion: v1
kind: Service
metadata:
name: file-monitoring-ms
labels:
app: file-monitoring-ms
spec:
selector:
app: file-monitoring-ms
ports:
- name: http
targetPort: 8000 # port the container accepts traffic on
port: 8000 # port other pods use to access the Service
protocol: TCP
【问题讨论】:
-
请将您问题中的图片替换为从终端复制的文字
-
这能回答你的问题吗? accessing services outside kubernetes