Open stevehipwell opened 6 months ago
I'd like to be able to override the subnet default hostname type for EC2 instances created by Karpenter
@stevehipwell Is this a launch template configuration setting?
@jonathan-innis I think it is. However the general docs which says that you can use the resource name for hostname in all scenarios is contradicted in other documents. I think this is still useful if you need an IPv6 enabled subnet, but less compelling.
I can confirm that it's a launch template configuration setting. I'm not sure what docs you're referring to @stevehipwell, but I just tried launching an EC2 instance in an IPv4-only VPC with the "resource name" hostname type and it definitely configured the hostname accordingly. I'd love to see this feature!
EDIT: my read of the launch template design doc suggests that we might not want a control knob for this. If that's the case, then I argue that we should always configure the launch template to use the "resource name" configuration setting, because the default configuration setting of "IP Name" is referred to as a legacy naming scheme in the docs. As an added bonus, it sounds like this would make kops and eks more consistent?
Happy to try my hand at a PR for this if I can get some guidance on making this behavior always true vs making it opt-in/configurable.
Tried to use this with karpenter https://awslabs.github.io/amazon-eks-ami/nodeadm/doc/examples/#using-instance-id-as-node-name-experimental Unfortunately kubelet then cannot register in cluster:
Sep 20 09:36:25 ip-10-20-7-154.eu-north-1.compute.internal kubelet[2119]: E0920 09:36:25.288492 2119 kubelet_node_status.go:92] "Unable to register node with API server" err="nodes \"i-0018a651259c57f2d\" is forbidden: node \"ip-10-20-7-154.eu-north-1.compute.internal\" is not allowed to modify node \"i-0018a651259c57f2d\"" node="i-0018a651259c57f2d"
Update: it does not work with "EKS API" auth in EKS. Only works with "ConfigMap" auth, exactly as written in docs. Node name in k8s and EC2 "Name" tag becomes "i-xxx". But actual hostname of OS still is "ip-x-x-x-x"
Description
What problem are you trying to solve? I'd like to be able to override the subnet default hostname type for EC2 instances created by Karpenter.
How important is this feature to you? This is a nice to have based on consistency with nodes created from an autoscaling group & launch template pattern.