cluster-api-provider-proxmox icon indicating copy to clipboard operation
cluster-api-provider-proxmox copied to clipboard

Node label node.kubernetes.io/proxmox-node not set

Open chrodriguez opened this issue 4 months ago • 4 comments

What steps did you take and what happened: Reading documentation, and searching for some examples, I've found this template called cluster-template-proxmox-labels.yaml.

I've thought that it could be possible to add custom lables as example shows, but I've realized that cloud-init is not adding to proxmox metadata datasource (NoCLoud?), proxmox_node as expected.

What did you expect to happen: I expect to understand if there is a way to inject this field in some bootstrap step, updating documentation to easily configure this example properly.

Anything else you would like to add: I've use this same configuration editing KubeadmControlPlane and KubeadmConfigTemplate but nodes failed to initialize because kubelet gets jinja errors replacing variables,

  • Proxmox version8.4.0:
  • Cluster-api-provider-proxmox version: v0.7.2
  • Kubernetes version: (use kubectl version): 1.33.2
  • OS (e.g. from /etc/os-release): ubuntu 24.04

chrodriguez avatar Jul 16 '25 10:07 chrodriguez

Our injection scripts do not support this. If you really need them, you can try to add those infos in the metadata template, and build a custom image.

https://github.com/ionos-cloud/cluster-api-provider-proxmox/blob/e31953e7c9340659154357d456a985fa2b090535/pkg/cloudinit/metadata.go#L20-L28

On our end, we use another controller to specify those labels, but it's not Open-source yet.

I can suggest to you that the proxmox-node is already in the Node.status, you can probably use some kubeadmPostCommand to add a label, and for the zones, it's up to you to define what kind of zones your setup have.

mcbenjemaa avatar Jul 18 '25 13:07 mcbenjemaa

Thanx! I'll try with your suggestions and if I'm success I'll create a PR

chrodriguez avatar Jul 18 '25 20:07 chrodriguez

I've finally managed to add required labels using https://github.com/sergelogvinov/proxmox-cloud-controller-manager. Installing helm chart with:

config:
  features:
    provider: capmox
    network:
      mode: auto

There is a requirement for this feature to work as expected. When creating machines, kubelet must set an extra argument cloud-provider=external. This can be added using KubeadmConfigTemplate and KubeadmControlPlane

KubeadmConfigTemplate

apiVersion: bootstrap.cluster.x-k8s.io/v1beta1
kind: KubeadmConfigTemplate
spec:
  template:
    metadata: {}
    spec:
      format: cloud-config
      joinConfiguration:
        discovery: {}
        nodeRegistration:
          imagePullPolicy: IfNotPresent
          kubeletExtraArgs:
            cloud-provider: external
            provider-id: proxmox://'{{ ds.meta_data.instance_id }}'
....

KubeadmControlPlane

apiVersion: controlplane.cluster.x-k8s.io/v1beta1
kind: KubeadmControlPlane
spec:
  kubeadmConfigSpec:
  ....
    initConfiguration:
      localAPIEndpoint: {}
      nodeRegistration:
        imagePullPolicy: IfNotPresent
        kubeletExtraArgs:
          cloud-provider: external
          provider-id: proxmox://'{{ ds.meta_data.instance_id }}'
    joinConfiguration:
      discovery: {}
      nodeRegistration:
        imagePullPolicy: IfNotPresent
        kubeletExtraArgs:
          cloud-provider: external
          provider-id: proxmox://'{{ ds.meta_data.instance_id }}'
....

Proxmox Cloud Controller helm chart

With this changes, and installing proxmox cloud controller helm chart:

helm upgrade -i --namespace=kube-system -f proxmox-ccm.yaml \                                                                                                                            
    proxmox-cloud-controller-manager \
    oci://ghcr.io/sergelogvinov/charts/proxmox-cloud-controller-manager

Where proxmox-ccm.yaml is

config:
  features:
    provider: capmox
    network:
      mode: auto
  clusters:
    - url: https://pve.example.net:8006/api2/json
      insecure: true
      token_id: "k8s-csi@pve!k8s-csi"
      token_secret: "Super!"
      region: management

This will add to every node the following labels:

  • topology.kubernetes.io/region=management
  • topology.kubernetes.io/zone=pve
  • failure-domain.beta.kubernetes.io/region=management
  • failure-domain.beta.kubernetes.io/zone=pve

Where proxmox node is named pve in my Proxmox Cluster

chrodriguez avatar Aug 06 '25 18:08 chrodriguez

It may be useful to add this as part of the documentation, if you think it will be useful, I can create a PR @mcbenjemaa. Thanks

chrodriguez avatar Aug 06 '25 18:08 chrodriguez