0

I have yaml file. It creates two deployments, both pods inside turned on the hostnetwork.

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

In this case, the pods will have the same clusterIP or DNS name. I want to connect the PODs by DNS or IP, and use SNMP to monitor their CPU metrics; but the problem is that, the IP or DNS cannot distinguish the two PODs anymore, cause it always goes to the host. Is there any solution for this case?

Howard
  • 3,638
  • 4
  • 32
  • 39
  • Is there a necessity to collect metrics using only SNMP? You can try to use Kubernetes Metrics Server to gather CPU load as well. Here is the link https://github.com/kubernetes-incubator/metrics-server#kubernetes-metrics-server – Artem Golenyaev Dec 04 '18 at 12:26
  • The reason is that, we have thousands of monitoring templates to work with SNMP, and it works fine outside of K8s. Now the services are moved to K8s and hopefully they can still work with with as less as possible changes. But your comment really helps and gave me a new clue for this issue. Thank you so much. – Howard Dec 04 '18 at 12:58

0 Answers0