Skip to content

[Feature Request] set k8s node label to indicate physical machine #540

Open

Activity

  1. matofeder commented on Mar 6, 2024

    @matofeder
    Member

    I can confirm that the hostID is available, and based on a quick test, I can also confirm that the hostID field in the VM details contains the unique hypervisor host identification (tested with the OSISM OpenStack Testbed):

    Two of the three VMs have been created in the same hypervisor host testbed-node-0:

    openstack server create --flavor SCS-1V-2 --image "Cirros 0.6.2" --availability-zone nova:testbed-node-0 test-1
    openstack server create --flavor SCS-1V-2 --image "Cirros 0.6.2" --availability-zone nova:testbed-node-0 test-2
    openstack server create --flavor SCS-1V-2 --image "Cirros 0.6.2" --availability-zone nova:testbed-node-1 test-3
    

    HostIDs for test-1 and test-2 VMs are the same, test-3 has a different one:

    $ openstack server show test-1 -c name -c hostId
    +--------+----------------------------------------------------------+
    | Field  | Value                                                    |
    +--------+----------------------------------------------------------+
    | hostId | e9c78f3c4e83f07f488ce2940e4be64a4b9064889554e9201b817d4d |
    | name   | test-1                                                   |
    +--------+----------------------------------------------------------+
    $ openstack server show test-2 -c name -c hostId
    +--------+----------------------------------------------------------+
    | Field  | Value                                                    |
    +--------+----------------------------------------------------------+
    | hostId | e9c78f3c4e83f07f488ce2940e4be64a4b9064889554e9201b817d4d |
    | name   | test-2                                                   |
    +--------+----------------------------------------------------------+
    $ openstack server show test-3 -c name -c hostId
    +--------+----------------------------------------------------------+
    | Field  | Value                                                    |
    +--------+----------------------------------------------------------+
    | hostId | 41e0aa102d80badf272692ebc58339a8c3f9032802d034148504fe83 |
    | name   | test-3                                                   |
    +--------+----------------------------------------------------------+
    

    We discussed with @jschoone and @chess-knight regarding our next steps, given that there appears to be no clear decision from the upstream on where this implementation should take place. It does not seem realistic to push/merge this upstream before R6.

    As a temporary workaround, we discussed the following:

    1. Creating another script or extending the existing scs-0214-v1 script to be cloud-specific (openstack-specific).
    2. Ensuring the script has access to the underlying OpenStack infrastructure.
    3. Having the script retrieve the list of Host IDs and corresponding hostnames using the OpenStack API.
    4. Validating k8s-node-distribution based on the label 'kubernetes.io/hostname' retrieved from the K8s API and information from step 3.
  2. berendt commented on Mar 6, 2024

    @berendt

    We work a lot with live migrations in the infrastructure. How do we take this into account when we work with the hostId?

  3. matofeder commented on Mar 6, 2024

    @matofeder
    Member

    We work a lot with live migrations in the infrastructure. How do we take this into account when we work with the hostId?

    Wouldn't the hostId also change in that case? If yes, I would say that the scs-0214-v1 script should work.

  4. mbuechse commented on Mar 6, 2024

    @mbuechse
    Author

    We need some label that has a 1:1 correspondence with the physical machines (at least when IaaS is not nested). And I think a hash of the project id and the actual hostname should work. We may run into a problem if somehow the nodes are distributed over multiple projects that share compute hosts, but I don't know if that is likely or even possible.

  5. chess-knight commented on Mar 7, 2024

    @chess-knight
    Member

    We need some label that has a 1:1 correspondence with the physical machines (at least when IaaS is not nested). And I think a hash of the project id and the actual hostname should work. We may run into a problem if somehow the nodes are distributed over multiple projects that share compute hosts, but I don't know if that is likely or even possible.

    I never heard about the k8s cluster across multiple OpenStack projects(tenants)!

  6. jschoone commented on Mar 7, 2024

    @jschoone

    We need some label that has a 1:1 correspondence with the physical machines (at least when IaaS is not nested). And I think a hash of the project id and the actual hostname should work. We may run into a problem if somehow the nodes are distributed over multiple projects that share compute hosts, but I don't know if that is likely or even possible.

    I never heard about the k8s cluster across multiple OpenStack projects(tenants)!

    Had the same thoughts. Technical I think it's possible somehow, but we don't support it and we decide if someone builds it on their own it's on their own risk.
    Where it's more likely in SCS context is when deploying Kubernetes clusters using interconnectivity. But then "topology.kubernetes.io/region" and/or "topology.kubernetes.io/zone" differs so we should be safe.

  7. matofeder commented on Mar 11, 2024

    @matofeder
    Member

    Outcome of the meeting held on Friday, March 8, at 2:05 PM with attendees @jschoone, @mbuechse, @cah-hbaum, @chess-knight, and @matofeder:

    • We reached a consensus that the optimal strategy is to tackle this issue upstream. While acknowledging previous efforts in this direction, we noted that it remains incomplete. Our plan is to provide contribution upstream to reach the resolution.

    • Simultaneously, we recognized the need for a functional Standard test for SCS KaaS v1 and V2. Consequently, we have decided to implement a pre-run job. This job will precede the SCS Standard test and utilize OpenStack CLI to fetch the hypervisor HostID. Afterwards, it will create a label on the Kubernetes node with the HostID, enabling recognition by the SCS Standard test.

  8. matofeder commented on Mar 13, 2024

    @matofeder
    Member

    The E2E pipeline for KaaS V1 has been adjusted.
    It now includes the execution of both Kubernetes standards (anti-affinity and k8s version policy).
    Additionally, it includes pre-standard tasks that label Kubernetes nodes before the anti-affinity standard (SCS-0214) is executed (see PR). The same for KaaS V2 is in progress.

    I expect that after @mbuechse and @cah-hbaum make the necessary changes in both standard scripts, the E2E pipeline will work with little or no adjustments.

    Also be aware that based on the discussion with @cah-hbaum and @chess-knight , we agreed that the custom k8s label for the hypervisor Host ID will be topology.scs.openstack.org/host-id. As we do not have a strong opinion here, any other proposals are welcomed.

  9. martinmo commented on Mar 14, 2024

    @martinmo
    Member

    Thanks for pushing this forward, this looks really good!

    Also be aware that based on the discussion with @cah-hbaum and @chess-knight , we agreed that the custom k8s label for the hypervisor Host ID will be topology.scs.openstack.org/host-id. As we do not have a strong opinion here, any other proposals are welcomed.

    Is this supposed to be a temporary label? Actually, even if it is, I would recommend using a domain that belongs to SCS for the label, so people encountering it can find us. For example: topology.scs.community/host-id.

  10. matofeder commented on Mar 14, 2024

    @matofeder
    Member

    Is this supposed to be a temporary label? Actually, even if it is, I would recommend using a domain that belongs to SCS for the label, so people encountering it can find us. For example: topology.scs.community/host-id.

    It serves as a temporary label until upstream proposes and implements an alternative label/solution.
    Regarding the name, I agree, see SovereignCloudStack/k8s-cluster-api-provider@ffb722b

  11. matofeder commented on Mar 18, 2024

    @matofeder
    Member

    FYI: A generic Kubernetes cloud provider implementation now supports the addition of additional cloud-specific labels. Consequently, the cloud provider OpenStack can utilize this interface to easily add labels such as the HostID label to the node. See the related comment for details: https://github.com/kubernetes/cloud-provider/issues/67

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementkaas-hackathon

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions