mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-10 12:32:03 +00:00
use lowercase hostnames for node names
Usage of names containing uppercase characters returned by calls to gethostname and getfqdn in requests to apiserver related to nodes results in 404 errors. Node names are lowercase in K8s itself so charms should make sure to use lowercase names well as it results in errors. pkg/util/node/node.go has code to convert hostnames to lowercase in GetHostname and that function is used to form node names.
This commit is contained in:
parent
76b4699c69
commit
7e2caf02ac
@ -173,7 +173,7 @@ def shutdown():
|
||||
'''
|
||||
try:
|
||||
if os.path.isfile(kubeconfig_path):
|
||||
kubectl('delete', 'node', gethostname().lower())
|
||||
kubectl('delete', 'node', get_node_name())
|
||||
except CalledProcessError:
|
||||
hookenv.log('Failed to unregister node.')
|
||||
service_stop('snap.kubelet.daemon')
|
||||
@ -314,7 +314,7 @@ def send_data(tls, kube_control):
|
||||
sans = [
|
||||
hookenv.unit_public_ip(),
|
||||
ingress_ip,
|
||||
gethostname()
|
||||
get_node_name()
|
||||
]
|
||||
|
||||
# Create a path safe name by removing path characters from the unit name.
|
||||
@ -1058,9 +1058,9 @@ def get_node_name():
|
||||
elif is_state('endpoint.openstack.ready'):
|
||||
cloud_provider = 'openstack'
|
||||
if cloud_provider == 'aws':
|
||||
return getfqdn()
|
||||
return getfqdn().lower()
|
||||
else:
|
||||
return gethostname()
|
||||
return gethostname().lower()
|
||||
|
||||
|
||||
class ApplyNodeLabelFailed(Exception):
|
||||
|
Loading…
Reference in New Issue
Block a user