Skip to content
This repository has been archived by the owner on Feb 10, 2022. It is now read-only.

bad value on node for label kubernetes-io/hostname in case of openstack #341

Open
obeyler opened this issue Jul 26, 2019 · 0 comments
Open

Comments

@obeyler
Copy link
Contributor

obeyler commented Jul 26, 2019

What happened:
kubernetes.io/hostname label of node is set to Ip adress instead of hostname

image

on K8S doc they say that the normal behavior is to put hostname :
https://kubernetes.io/docs/reference/kubernetes-api/labels-annotations-taints/#kubernetes-io-hostname
some product such as OpenEBS use this label as node selector so they are not able to select the right node

Node-Selectors: kubernetes.io/hostname=vm-7ea13877-8947-476f-a125-b642ee34fbc0

What you expected to happen:
put the hostname and not the Ip as value of kubernetes.io/hostname

Anything else we need to know?:
I think that the trouble is located there :

get_hostname_override() {
if [[ "gce" == "$cloud_provider" ]]; then
hostname_override=$(curl http://metadata.google.internal/computeMetadata/v1/instance/name -H "Metadata-Flavor: Google")
elif [[ "azure" == "$cloud_provider" ]]; then
# K8s 1.9 Azure provider assumes the hostname == nodename and is required to resolve the VM instance ID
hostname_override=
else
hostname_override=<%= spec.ip %>
fi

on openstack we can get the hostname of the iaas vm by this way:

VAR=$(curl http://169.254.169.254/2009-04-04/meta-data/hostname)
hostname_override=${VAR%.novalocal}

and may another good/best solution is to allow as an option to set it to the result of hostname linux command of the vm (witch is also another value)

Environment:

  • Deployment Info (bosh -d <deployment> deployment): cfcr-34
  • Environment Info (bosh -e <environment> environment):
  • Kubernetes version (kubectl version): 1.14.1
  • Cloud provider (e.g. aws, gcp, vsphere): openstack
@obeyler obeyler changed the title https://kubernetes.io/docs/reference/kubernetes-api/labels-annotations-taints/#kubernetes-io-hostname bad value on node for label kubernetes-io/hostname in case of openstack Jul 26, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants