goldpinger icon indicating copy to clipboard operation
goldpinger copied to clipboard

Unable to specify name of instances using HOSTNAME env

Open yuripastushenko opened this issue 3 years ago • 3 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.

yuripastushenko avatar Jan 22 '21 13:01 yuripastushenko

@yuripastushenko have you managed to solve this?

zout avatar Nov 28 '21 19:11 zout

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.

ifelsefi avatar Feb 16 '22 18:02 ifelsefi

Did you set DISPLAY_HOSTNAME=true? As found here: https://github.com/bloomberg/goldpinger/pull/118#issuecomment-1262383990

elmarx avatar Sep 10 '23 22:09 elmarx