Jaeger-operator: Failed to create a jaeger instances when POD_NAMESPACE is empty

Created on 22 Oct 2019  路  2Comments  路  Source: jaegertracing/jaeger-operator

Hey,
I'm trying to create a jaeger instance in K8s v1.16 but the jaeger-operator (v1.14) seems to fail when creating an instance with the following error:

time="2019-10-22T14:12:12Z" level=error msg="failed to set this operator as the manager of the instance" error="Jaeger.jaegertracing.io \"my-jaeger\" is invalid: metadata.labels: Invalid value: \".jaeger-operator\": a valid label must be an empty string or consist of alphanumeric characters, '-', '_' or '.', and must start and end with an alphanumeric character (e.g. 'MyValue',  or 'my_value',  or '12345', regex used for validation is '(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?')" execution="2019-10-22 14:12:12.663564223 +0000 UTC" instance=my-jaeger namespace=tracing operator-identity=.jaeger-operator

The error seems to indicate that there is a prefixed . in the jaeger-operator name.

jaeger-operator YAML is like:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: jaeger-operator
  namespace: tracing
spec:
  replicas: 1
  selector:
    matchLabels:
      name: jaeger-operator
  template:
    metadata:
      labels:
        name: jaeger-operator
    spec:
      serviceAccountName: jaeger-operator
      containers:
        - name: jaeger-operator
          image: jaegertracing/jaeger-operator:v1.14.0
          ports:
          - containerPort: 8383
            name: metrics
          args: ["start"]
          imagePullPolicy: Always
          env:
            - name: WATCH_NAMESPACE
              value: ""
            - name: POD_NAME
              valueFrom:
                fieldRef:
                  fieldPath: metadata.name
            - name: OPERATOR_NAME
              value: "jaeger-operator"

and the actual instance is:

apiVersion: jaegertracing.io/v1
kind: Jaeger
metadata:
  name: my-jaeger
  namespace: tracing
spec:
  strategy: allInOne
  allInOne:
    image: jaegertracing/all-in-one:1.14
    options:
      log-level: debug
      query:
        base-path: /jaeger
  storage:
      type: elasticsearch
      options:
        es:
          server-urls: http://elasticsearch.kube-logging:9200
          max-span-age: 14
      dependencies:
        enabled: true
  ingress:
    enabled: false

Is this actually an issue or am I missing something? I'm sure that this configuration worked at least in K8s 1.12

Kind regards
Georg

bug

Most helpful comment

The error seems to indicate that there is a prefixed . in the jaeger-operator name.

That's exactly it. The problem is that your operator.yaml is missing the POD_NAMESPACE, which was added recently. You should be seeing the following as the first lines of the operator's log:

time="2019-10-23T07:00:44Z" level=warning msg="the POD_NAMESPACE env var isn't set, this operator's identity might clash with another operator's instance"
time="2019-10-23T07:00:44Z" level=info msg=Versions arch=amd64 identity=.jaeger-operator jaeger=1.14.0 jaeger-operator=v1.14.0 operator-sdk=v0.8.1 os=linux version=go1.12.7

To fix it, add the following at the same level as the POD_NAME:
https://github.com/jaegertracing/jaeger-operator/blob/281ce628799c33f60b1539407c2fc2bc1eee94e3/deploy/operator.yaml#L32-L35

The operator should not fail in this situation, though. To fix that, I'm sending a PR soon.

All 2 comments

I could reproduce this with Kubernetes v1.15.2 as well.

The error seems to indicate that there is a prefixed . in the jaeger-operator name.

That's exactly it. The problem is that your operator.yaml is missing the POD_NAMESPACE, which was added recently. You should be seeing the following as the first lines of the operator's log:

time="2019-10-23T07:00:44Z" level=warning msg="the POD_NAMESPACE env var isn't set, this operator's identity might clash with another operator's instance"
time="2019-10-23T07:00:44Z" level=info msg=Versions arch=amd64 identity=.jaeger-operator jaeger=1.14.0 jaeger-operator=v1.14.0 operator-sdk=v0.8.1 os=linux version=go1.12.7

To fix it, add the following at the same level as the POD_NAME:
https://github.com/jaegertracing/jaeger-operator/blob/281ce628799c33f60b1539407c2fc2bc1eee94e3/deploy/operator.yaml#L32-L35

The operator should not fail in this situation, though. To fix that, I'm sending a PR soon.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

wangycc picture wangycc  路  5Comments

samcrutt9900 picture samcrutt9900  路  6Comments

shubhanshus picture shubhanshus  路  9Comments

qbast picture qbast  路  8Comments

figaw picture figaw  路  4Comments