【发布时间】:2018-01-17 03:09:16
【问题描述】:
我可以在一个 Kubernetes 集群中创建两个容器在相同端口上运行的 pod 吗?考虑到这将为两者创建单独的服务。
类似这样的:
-- 部署1
kind: Deployment
spec:
containers:
- name: <name>
image: <image>
imagePullPolicy: Always
ports:
- containerPort: 8080
-- 服务1
kind: Service
spec:
type: LoadBalancer
ports:
- port: 8081
targetPort: 8080
-- 部署2
kind: Deployment
spec:
containers:
- name: <name>
image: <image>
imagePullPolicy: Always
ports:
- containerPort: 8080
-- 服务 2
kind: Service
spec:
type: LoadBalancer
ports:
- port: 8082
targetPort: 8080
但这种方法行不通。
【问题讨论】:
标签: kubernetes