mirror of
https://github.com/floci-io/floci.git
synced 2026-12-01 09:22:49 -05:00
fix(eks): name an EKS Auto Mode node by its instance ID when its image runs a kubelet (#9785)
An EKS Auto Mode instance whose image's own kubelet registers its node (kubeletRegistersNode) was looked for under its private DNS name, while the node is authenticated as system:node:<instance-id>. Node restriction refuses that kubelet a node under the DNS name, and one registered under the instance ID was never found, so the instance was terminated once its registration wait was up. The node is now named by the instance ID whoever registers it, and the NodeConfig Auto Mode launches with turns on nodeadm's InstanceIdNodeName feature gate, so the kubelet registers it under that name.
This commit is contained in:
1 parent
c759246a4a
commit
b356fefeae
5 files changed
+33
-6
No files matched your search
@@ -148,6 +148,8 @@ class EksAutoModeComputeTest {
|
||||
name: prod
|
||||
apiServerEndpoint: https://prod.example
|
||||
certificateAuthority: Q0E=
|
||||
featureGates:
|
||||
InstanceIdNodeName: true
|
||||
kubelet:
|
||||
flags:
|
||||
- --node-labels=kubernetes.io/arch=amd64,kubernetes.io/os=linux,node.kubernetes.io/instance-type=c7a.large,karpenter.sh/capacity-type=on-demand,eks.amazonaws.com/instance-category=c,eks.amazonaws.com/instance-generation=7,eks.amazonaws.com/instance-family=c7a,eks.amazonaws.com/instance-size=large,eks.amazonaws.com/instance-cpu=2,eks.amazonaws.com/instance-memory=4096,karpenter.sh/nodepool=general-purpose,eks.amazonaws.com/compute-type=auto,topology.kubernetes.io/zone=us-east-1a
|
||||
|
||||
@@ -5846,6 +5846,27 @@ class EksClusterManagerTest {
|
||||
assertEquals(2, commands.getAllValues().size());
|
||||
}
|
||||
|
||||
/**
|
||||
* An Auto Mode instance whose image's own kubelet registers the node is named by its instance ID too, as its
|
||||
* NodeConfig tells nodeadm and as the node is authenticated; another instance's kubelet keeps its private DNS
|
||||
* name.
|
||||
*/
|
||||
@Test
|
||||
void anAutoModeKubeletImagesNodeIsNamedByItsInstanceId() {
|
||||
Instance auto = createInstance("i-0auto1234567890ac", "us-east-1a", "t3.medium", "x86_64", "10.0.1.81");
|
||||
auto.setPrivateDnsName("ip-10-0-1-81.ec2.internal");
|
||||
auto.setImageId("ami-kubelet-worker");
|
||||
auto.setTags(List.of(new Tag(EksAutoModeCompute.MANAGED_LAUNCH_TAG, EksAutoModeCompute.MANAGED_LAUNCH)));
|
||||
Instance worker = createInstance("i-0work1234567890ac", "us-east-1a", "t3.medium", "x86_64", "10.0.1.82");
|
||||
worker.setPrivateDnsName("ip-10-0-1-82.ec2.internal");
|
||||
worker.setImageId("ami-kubelet-worker");
|
||||
|
||||
assertTrue(manager.kubeletRegistersNode(auto));
|
||||
assertEquals("i-0auto1234567890ac", manager.deriveInstanceNodeName(auto, "us-east-1"));
|
||||
assertEquals("ip-10-0-1-81.ec2.internal", manager.deriveInstanceDnsName(auto, "us-east-1"));
|
||||
assertEquals("ip-10-0-1-82.ec2.internal", manager.deriveInstanceNodeName(worker, "us-east-1"));
|
||||
}
|
||||
|
||||
/** As a kubelet does: the node registers with the labels and taints its NodeConfig's kubelet flags name. */
|
||||
@Test
|
||||
void aSyntheticNodeRegistersWithItsNodeConfigsLabelsAndTaints() {
|
||||
|
||||
Reference in new issue
Block a user