bloomberg/goldpinger

Unable to specify name of instances using HOSTNAME env

yuripastushenko opened this issue · 4 comments

Describe the bug
The value of env variable HOSTNAME is not applied to goldpinger instance.

Steps To Reproduce
Deploy goldpinger using yaml example:

---
apiVersion: v1
kind: ServiceAccount
metadata:
  name: goldpinger-serviceaccount
---
apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: goldpinger
  namespace: default
  labels:
    app: goldpinger
spec:
  updateStrategy:
    type: RollingUpdate
  selector:
    matchLabels:
      app: goldpinger
  template:
    metadata:
      annotations:
        prometheus.io/scrape: 'true'
        prometheus.io/port: '8080'
      labels:
        app: goldpinger
    spec:
      serviceAccount: goldpinger-serviceaccount
      tolerations:
        - key: node-role.kubernetes.io/master
          effect: NoSchedule
      securityContext:
        runAsNonRoot: true
        runAsUser: 1000
        fsGroup: 2000
      containers:
        - name: goldpinger
          env:
            - name: HOST
              value: "0.0.0.0"
            - name: PORT
              value: "8080"
            # injecting real hostname will make for easier to understand graphs/metrics
            - name: HOSTNAME
              valueFrom:
                fieldRef:
                  fieldPath: spec.nodeName
            # podIP is used to select a randomized subset of nodes to ping.
            - name: POD_IP
              valueFrom:
                fieldRef:
                  fieldPath: status.podIP
          image: "docker.io/bloomberg/goldpinger:v3.0.0"
          imagePullPolicy: Always
          securityContext:
            allowPrivilegeEscalation: false
            readOnlyRootFilesystem: true
          resources:
            limits:
              memory: 80Mi
            requests:
              cpu: 1m
              memory: 40Mi
          ports:
            - containerPort: 8080
              name: http
          readinessProbe:
            httpGet:
              path: /healthz
              port: 8080
            initialDelaySeconds: 20
            periodSeconds: 5
          livenessProbe:
            httpGet:
              path: /healthz
              port: 8080
            initialDelaySeconds: 20
            periodSeconds: 5
---
apiVersion: v1
kind: Service
metadata:
  name: goldpinger
  namespace: default
  labels:
    app: goldpinger
spec:
  type: NodePort
  ports:
    - port: 8080
      nodePort: 30080
      name: http
  selector:
    app: goldpinger

Expected behavior
In UI, goldpinger instances have name of the nodes where they are placed.

Actual behavior
In UI, goldpinger instances have name of the pods where they are placed.

Screenshots
kubectl get nodes -o wide output:
Снимок экрана 2021-01-22 в 16 29 01
Goldpinger UI screenshot:
Снимок экрана 2021-01-22 в 16 26 12

Environment (please complete the following information):

  • Kubernetes version v1.17.6

Comments

  • If I change PORT env - goldpinger applies this change.
  • If I start a pod with same yaml, but without readiness probes and change image to ubuntu - the environment variable HOSTNAME is passed in container.
zout commented

@yuripastushenko have you managed to solve this?

I have the same issue on 3.4.1 with no config changes.

The web ui shows the pod name not hostnames. I am running a 1.19 k8s cluster.

elmarx commented

Did you set DISPLAY_HOSTNAME=true? As found here: #118 (comment)