有没有办法通过IP或DNS来区分已打开主机网络的两个Pod?

时间:2018-12-04 10:09:31

标签: kubernetes hostnetwork

我有yaml文件。它创建了两个部署,内部的两个Pod都打开了主机网络。

apiVersion: apps/v1beta1
kind: Deployment
metadata:
  name: busybox
spec:
  replicas: 1
  template:
    metadata:
      labels:
        app: busybox
    spec:
      hostNetwork: true
      hostname: busybox-1
      subdomain: default-subdomain
      containers:
      - image: busybox
        command:
          - sleep
          - "3600"
        name: busybox

---
apiVersion: apps/v1beta1
kind: Deployment
metadata:
  name: influxdb-deployment
spec:
  replicas: 1
  template:
    metadata:
      labels:
        app: influxdb-deployment
    spec:
      hostNetwork: true
      containers:
      - name: influxdb-deployment
        image: influxdb

在这种情况下,吊舱将具有相同的clusterIP或DNS名称。我想通过DNS或IP连接POD,并使用SNMP监视其CPU指标;但是问题在于,IP或DNS不再能够区分两个POD,因为它总是传给主机。有什么解决方案吗?

0 个答案:

没有答案