【发布时间】:2019-01-28 08:26:54
【问题描述】:
我制作了一个客户 pod(包括在端口 8080 上运行 Spring Boot 应用程序的映像)。
** 在 yaml 文件中,我没有明确写容器端口号,例如 spec:containers:port:8080。
kind: Pod
apiVersion: v1
metadata:
name: customer-pod
spec:
containers:
- name: customer-pod
image: docker.temp.com/customer-service:8
我可以用“$ kubectl get pods commands -o wide”来检查它
=============================================
NAME READY STATUS RESTARTS AGE IP 节点
customer-pod 1/1 Running 0 43m 10.43.1.17 默认
=============================================
之后,
$ curl 10.43.1.17:8080
{"timestamp":"2018-08-22T05:58:58.938+0000","status":404,"error":"Not Found","message":"No message available","path":"/ "}
我想知道如何在不打开端口的情况下访问客户端口(8080)。
如果是 Docker,我知道我应该在运行命令中明确写一个端口来连接它。
在 Kubernetes 中,端口是自动打开的吗?
【问题讨论】:
标签: kubernetes