您如何通过使用端口8080的服务在OpenShift中部署一个应用程序?
我很难理解Kubernetes网络,希望有人比文档更简单。
我的测试服务如下,包含我到目前为止有关端口和网络的所有信息。
它正在返回503。
# A Service can map any incoming port to a targetPort.
# By default and for convenience, the `targetPort`
# is set to the same value as the port field
apiVersion: v1
kind: Service
metadata:
name: my-app
spec:
ports:
- name: HTTP
# port is the stable port the Service exposes inside
# the cluster — other Pods in the cluster send traffic
# to this port
port: 5000
protocol: TCP
# if you don’t specify a targetPort value,
# it defaults to the value specified in port
# targetPort is the port that the container,
# within the Pod, listens on for incoming traffic.
targetPort: 80
selector:
app: my-app
route.yml - targetPort: 80
deployment.yml - containerPort: 80
I am having a hard time understanding Kubernetes networking and would like someone to explain it a little simpler than the documentation does.
My test service is below and contains all that I understand so far about ports and networking in Openshift/Kubernetes.
It is returning a 503 right now.
# A Service can map any incoming port to a targetPort.
# By default and for convenience, the `targetPort`
# is set to the same value as the port field
apiVersion: v1
kind: Service
metadata:
name: my-app
spec:
ports:
- name: HTTP
# port is the stable port the Service exposes inside
# the cluster — other Pods in the cluster send traffic
# to this port
port: 5000
protocol: TCP
# if you don’t specify a targetPort value,
# it defaults to the value specified in port
# targetPort is the port that the container,
# within the Pod, listens on for incoming traffic.
targetPort: 80
selector:
app: my-app
route.yml - targetPort: 80
deployment.yml - containerPort: 80
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以在我的github帐户下读取微小的代码段,以熟悉Nutshell中的K8S网络: https://github.com/nirgeier/kuberneteslabs/tree/master/master/labs/05-services
实验室将详细描述您要问的内容。
来回答您的问题:
让
我们
尝试测试我们的网络
You can read out the tiny code snippets under my Github account to get familiar with K8S networking in nutshell: https://github.com/nirgeier/KubernetesLabs/tree/master/Labs/05-Services
The lab will describe in detail exactly what you are asking.
To answer your question:
Lets see the output
Service
Lets try to test our network