Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to specify name of instances using HOSTNAME env #99

Open
yuripastushenko opened this issue Jan 22, 2021 · 4 comments
Open

Unable to specify name of instances using HOSTNAME env #99

yuripastushenko opened this issue Jan 22, 2021 · 4 comments

Comments

@yuripastushenko
Copy link

yuripastushenko commented Jan 22, 2021

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
Copy link

zout commented Nov 28, 2021

@yuripastushenko have you managed to solve this?

@ifelsefi
Copy link

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
Copy link

elmarx commented Sep 10, 2023

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

@cmontemuino
Copy link

DISPLAY_HOSTNAME does not work, but DISPLAY_NODENAME

Source: https://github.com/bloomberg/goldpinger/blob/goldpinger-1.0.0/pkg/goldpinger/config.go#L38

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants