Skip to content

etcd pod has wrong etcd.advertise-client-urls annotation when setting differing etcd port via environment variables #382

@mueckinger

Description

@mueckinger

I wanted to set up a cluster with "multi-tenancy", so I've set export PORT_ETCD=12379 among others. I created a single-node cluster with the make commands according to the description and everything is working fine, but it seems that the differing port setting doesn't make it to the etcd.advertise-client-urls annotation of the pod (see below) which is crucial for control plane updates. In my case kubeadm upgrade apply v1.34.0 failed (from v1.33.4) because it doesn't find etcd at the specified url:

[upgrade/control-plane] Upgrading your static Pod-hosted control plane to version "v1.34.0" (timeout: 5m0s)...
I0829 10:39:33.182170   48426 etcd.go:215] retrieving etcd endpoints from "kubeadm.kubernetes.io/etcd.advertise-client-urls" annotation in etcd Pods
I0829 10:39:33.185523   48426 etcd.go:149] etcd endpoints read from pods: https://10.100.251.100:2379
error: error execution phase control-plane: couldn't complete the static pod upgrade: failed to create etcd client: error syncing endpoints with etcd: context deadline exceeded

Wrong annotation retrieved from etcd pod:

apiVersion: v1
kind: Pod
metadata:
  name: etcd-u7s-myhost
  namespace: kube-system
...
  annotations:
    kubeadm.kubernetes.io/etcd.advertise-client-urls: https://10.100.251.100:2379
...

I don't know where this annotation is calculated. What I can say is that the kubeadm-config.yaml created by make kubeadm-init had the correct ports:

apiVersion: kubeadm.k8s.io/v1beta4
kind: ClusterConfiguration
...
etcd:
  local:
    extraArgs:
      - name: listen-client-urls
        value: "https://127.0.0.1:12379,https://10.100.251.100:12379"
      - name: advertise-client-urls
        value: https://10.100.251.100:12379

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions