Skip to content
This repository was archived by the owner on Nov 5, 2021. It is now read-only.
This repository was archived by the owner on Nov 5, 2021. It is now read-only.

[GKE] Error initializing CloudProber #554

@guilledipa

Description

@guilledipa

Describe the bug

CloudProber running on GKE (Private cluster) fails to initialize due to GCE metadata "instance/name" not defined.

Here the CloudProber logs

I0119 03:27:39.770914       1 logger.go:153] Running on GCE. Logs for cloudprober.sysvars will go to Cloud (Stackdriver).
I0119 03:27:39.790349       1 logger.go:153] Running on GCE. Logs for cloudprober.global will go to Cloud (Stackdriver).
I0119 03:27:39.803867       1 logger.go:153] Running on GCE. Logs for cloudprober.jira-http will go to Cloud (Stackdriver).
I0119 03:27:39.805007       1 logger.go:153] Running on GCE. Logs for cloudprober.stackdriver will go to Cloud (Stackdriver).
F0119 03:27:39.806586       1 cloudprober.go:181] Error initializing cloudprober. Err: unable to retrieve instance name: metadata: GCE metadata "instance/name" not defined

Cloudprober Version

https://hub.docker.com/layers/cloudprober/cloudprober/v0.11.1/images/sha256-27fb01b0ecf1343b0d4c429f4e8ff97edaf687eae501d751f256e958b9432e54?context=explore

To Reproduce

I followed the steps described in here

I also tried the following workarounds:

  • "--cloud_metadata=none"
  • GCE_METADATA_HOST="metadata.google.internal"

Additional context

  • From another workload running on the same namespace, I tried the following:
curl -H "Metadata-Flavor:Google" http://metadata.google.internal/computeMetadata/v1/instance/hostname
gke-main-regular-nodes-7c755ecf-ytck.c.foo-sbx.internal

I'm able to fetch GCE metadata successfully.

  • K8s objects
---
apiVersion: v1
kind: ConfigMap
metadata:
  name: cloudprober-config
  namespace: sbx
  labels:
    app: cloudprober
data:
  cloudprober.cfg: |
    probe {
      name: "jira-http"
      type: HTTP
      targets {
        host_names: "foo-0.foo.sbx.svc.cluster.local"
      }
      http_probe {
          relative_url: "/status"
          port: 8080
      }
      interval_msec: 15000
      timeout_msec: 10000
      validator {
        name: "status_ok"
        regex: "RUNNING"
      }
    }
    surfacer {
      type: STACKDRIVER
    }
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: cloudprober
  namespace: sbx
  labels:
    app: cloudprober
spec:
  replicas: 1
  selector:
    matchLabels:
      app: cloudprober
  template:
    metadata:
      labels:
        app: cloudprober
    spec:
      volumes:
      - name: cloudprober-config
        configMap:
          name: cloudprober-config
      containers:
      - name: cloudprober
        image: internal_repo/cloudprober@sha256:XXXXX
        command: ["/cloudprober"]
        args: [
          "--config_file","/cfg/cloudprober.cfg",
          "--cloud_metadata=none",
          "--logtostderr",
          "-v=1"
        ]
        env:
        - name: GCE_METADATA_HOST
          value: "metadata.google.internal"
        volumeMounts:
        - name: cloudprober-config
          mountPath: /cfg
        ports:
        - name: http
          containerPort: 9313
---
apiVersion: v1
kind: Service
metadata:
  name: cloudprober
  namespace: sbx
  labels:
    app: cloudprober
spec:
  ports:
  - port: 9313
    protocol: TCP
    targetPort: 9313
  selector:
    app: cloudprober
  type: NodePort

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions