cut*_*ade 10 google-cloud-platform gcloud kubernetes google-kubernetes-engine
是否可以在Google容器引擎中创建一个暴露两个端口的Pod:端口8080正在侦听传入内容,端口80是否将此内容分发给客户端?
以下是创建Pod的命令,以Google为例:
kubectl run hello-node --image=gcr.io/${PROJECT_ID}/hello-node --port=8080
Run Code Online (Sandbox Code Playgroud)
我似乎无法定义监听端口,并且当添加第二个"--port ="开关时,只暴露一个端口.有没有办法暴露第二个端口或我限制为每个容器一个端口?
cae*_*hao 17
不,您不能指定多个端口kubectl run
.但您可以使用kubectl create
创建复制控制器,并为容器指定多个端口.
https://github.com/kubernetes/examples/blob/master/cassandra/cassandra-statefulset.yaml有一个例子:
ports:
- containerPort: 7000
name: intra-node
- containerPort: 7001
name: tls-intra-node
- containerPort: 7199
name: jmx
- containerPort: 9042
name: cql
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
22751 次 |
最近记录: |