Amazon VPC CNI는 노드마다 미리 잡아 두는 IP의 양을 aws-node DaemonSet 하나의 환경 변수(WARM_IP_TARGET / MINIMUM_IP_TARGET)로 정해서, 클러스터의 모든 노드가 같은 값을 씁니다. Karpenter가 여러 인스턴스 크기를 섞어 띄우는 EKS 클러스터에서, 공개 이슈 #3630에 소개된 Kyverno 우회 방법을 직접 테스트해 봤는데요, Kyverno가 aws-node Pod를 노드에 배치하는 순간 그 노드 크기에 맞는 값을 넣어 줬고, 작은 노드만 WARM 1 / MIN 3으로 낮추자 작은 노드 8대의 서브넷 IP가 64개에서 40개로 줄었습니다. 대신 일반 Pod를 한꺼번에 띄울 때는 시작이 늦어졌고, Kyverno가 응답하지 않을 때 failurePolicy가 Ignore이거나, 정책에 기본값이 없거나, 업그레이드 때 aws-node 매니페스트를 통째로 덮어쓰면 값이 빠졌습니다.Amazon VPC CNI sets how many IPs each node reserves with environment variables (WARM_IP_TARGET / MINIMUM_IP_TARGET) on the single aws-node DaemonSet, so every node in the cluster gets the same values. I tested the Kyverno workaround from public issue #3630 on an EKS cluster where Karpenter mixes instance sizes. Kyverno set the values for each node's size when the aws-node Pod was bound to the node, and with only the small nodes lowered to WARM 1 / MIN 3, eight small nodes used 40 subnet IPs instead of 64. The cost was a slower start when many regular Pods start at once. The values were lost when Kyverno was unreachable with failurePolicy Ignore, when the policy had no default, and when an upgrade replaced the whole aws-node manifest.
On EKS, the VPC CNI reserves IPs on each node ahead of time for the Pods it will run. How many it reserves is set by environment variables such as WARM_IP_TARGET / MINIMUM_IP_TARGET on the aws-node DaemonSet. There is only one DaemonSet, so every node in the cluster uses the same values.
With Cluster Autoscaler this was rarely a problem. The instance types in a node group need the same number of CPU cores and amount of RAM (Cluster Autoscaler AWS docs), so each node group usually held instances of about the same size, and one set of values fit most nodes. With Karpenter, one NodePool can allow many instance sizes and nodes launch with whatever size is available. When large instances can't be found, many small ones fill the same capacity. Each extra node reserves its own spare IPs, so the spare IPs grow with the node count.
When subnet IPs are tight, you want lower values on the small nodes only, but the VPC CNI has no such option yet. The feature request is public issue #3630, and a comment on it (May 15, 2026) describes a workaround that uses Kyverno to put the values into aws-node Pods. It doesn't say whether this holds up when Karpenter mixes sizes, or where it breaks in operation, so I tested it. I checked four questions:
This should help if you are moving from Cluster Autoscaler to Karpenter and want to allow more instance sizes, or if you are deciding whether to run the #3630 workaround in production. The test code is linked at the end.
With WARM_IP_TARGET and MINIMUM_IP_TARGET set, a node holds max(MINIMUM_IP_TARGET, Pods in use + WARM_IP_TARGET) secondary IPs. Without them, the default WARM_ENI_TARGET=1 keeps one whole spare ENI's worth of IPs (VPC CNI README). Every measurement in this post matched this formula. Below, WARM is WARM_IP_TARGET (spare IPs to keep free) and MIN is MINIMUM_IP_TARGET (IPs to hold at least), so "WARM 1 / MIN 3" means WARM_IP_TARGET=1, MINIMUM_IP_TARGET=3.
Because the values are aws-node environment variables, there are two ways to give each size its own values.
| Method | How it works |
|---|---|
| Method 1 · One DaemonSet per size | Copy aws-node per size (aws-node-large, aws-node-4xlarge) with fixed values and split them with node affinity on the size label. The original aws-node excludes those sizes (NotIn) and keeps the default values |
| Method 2 · Kyverno injection | Keep one aws-node. When an aws-node Pod is bound to a node (pods/binding), Kyverno reads the node's karpenter.k8s.aws/instance-size label and adds the values for that size as annotations. The API server copies Binding annotations to the Pod, and aws-node reads them into env through the downward API |
Table 1. Two ways to set per-size values
Figure 1. How Kyverno puts per-size values into aws-node (method 2). 1 Karpenter launches the node and labels it. 2 The aws-node binding goes to Kyverno. 3 The MutatingPolicy adds the values as annotations. 4 The gate denies the binding while the node has no size label or the values don't match its size, and the scheduler retries. 5 The API server copies them to the Pod. 6 aws-node reads them through the downward API.
The #3630 comment puts the values on node labels and has Kyverno copy them to the aws-node Pod, with the env set through the EKS add-on's extraEnv. Karpenter puts custom labels on nodes per NodePool, so per-size labels would need one NodePool per size. I kept the values in a table inside the policy, keyed by the instance-size label, and applied them at binding time. Method 2 adds two policies: a mutation that adds the values, and a gate that denies the binding while the node has no size label or while the added values don't match the node's size. Both match only aws-node-* bindings in kube-system, so other Pods are not affected by the policies.
01
| Test | Question | What I did | Result |
|---|---|---|---|
| Test 1 · Per-size injection | Does every new node get the values for its size? | Launched about 20 new nodes with method 1 and method 2 → checked the values each aws-node got and the gate denials | Right values in normal operation. In the rerun 1 of 8 got the defaults; with a value check added to the gate, 16 of 16 were right |
| Test 2 · IP saving on small nodes | How many IPs does lowering only the small nodes save? | 8 small nodes with 3 regular Pods each, values WARM 4 / MIN 6 and then WARM 1 / MIN 3 → counted subnet IPs | 64 → 40 subnet IPs (7 → 4 per node) |
| Test 3 · Pod start latency | How much slower do Pods start in exchange? | One small node: regular Pods 3 → 13 and SGPP Pods 0 → 9 → timed each Pod until Ready | WARM 1 / MIN 3: last regular Pod Ready after 65–83 s (16–32 s with WARM 4 / MIN 6). SGPP Pods 2–4 s either way |
| Test 4 · Kyverno failure | What happens to a new node when Kyverno fails? | Kyverno unreachable (Fail, Ignore) or at 0 replicas, then one new node → checked the node and its aws-node | Fail: node NotReady until Kyverno was back. Ignore and 0 replicas: aws-node on the defaults |
| Test 5 · Value mistakes | What does a wrong value in the policy do? | A size missing from the table with no default; values WARM 0 / MIN 0 and WARM 0 / MIN 3 → counted IPs and Pods without an IP | No default and WARM 0 / MIN 0 fell back to the defaults. WARM 0 / MIN 3: 10 new Pods got no IP for more than 5 minutes |
| Test 6 · Value change and upgrade | Do the values survive a value change and an aws-node upgrade? | Changed values with ping running; upgraded v1.23.2 → v1.23.3 with kubectl apply and kubectl replace | Changes need an aws-node restart, no ping loss. replace dropped the values (method 2); apply dropped the size split (method 1) |
Table 2. Results. Seoul Region (ap-northeast-2), December 2–4, 2026, Amazon EKS 1.36, self-managed VPC CNI v1.23.3, Karpenter v1.15.3, Kyverno v1.20.0
02
I built a separate test cluster with Terraform in the Seoul Region. The EKS API endpoint was private only, and I reached it through Session Manager port forwarding. Instead of very large instances I scaled the sizes down: m6i.4xlarge plays the large node and m6i.large the small fallback node, an 8× CPU ratio.
| Component | Configuration |
|---|---|
| Cluster | Amazon EKS 1.36, private API endpoint, one NAT gateway. Kyverno and Karpenter run on a managed node group of one t3.large |
| VPC CNI | v1.23.3, self-managed aws-node DaemonSet (not the EKS add-on). v1.23.4 was released during the test; the functions this post relies on are unchanged in it |
| Karpenter | v1.15.3, one NodePool with m6i.large, m6i.xlarge and m6i.4xlarge |
| Kyverno | v1.20.0 (Helm chart 3.10.0), one ValidatingPolicy (gate) and one MutatingPolicy (values) |
| Nodes | m6i.4xlarge: 8 ENIs × 30 IPv4 addresses. m6i.large: 3 ENIs × 10. m6i.xlarge: 4 ENIs × 15 |
| Workload | pause Pods, 3 regular Pods per node |
Table 3. Components and configuration
The IP counts come from the EC2 API (secondary IPs per ENI), the ipamd introspection API (IPs assigned to Pods), and the ipamd process environment (/proc/<pid>/environ), so they show the values aws-node actually ran with. Subnet use is the IPs a node holds plus one primary IP per ENI.
All tests ran one after another on this one cluster, in the order below. The test sections that follow are numbered by test, not by this order.
Figure 2. Test order on the one test cluster. The EC2 icon marks steps where Karpenter launched new nodes.
03
With method 2, about 20 nodes that Karpenter launched during normal operation all got the values for their size. The order of events on a new node can vary, though. On 2 nodes, the aws-node Pod was about to be placed on the node before the node had its size label (instance-size). At that point Kyverno can't tell the node's size, so it can't pick the right values. The gate denied that placement once, and about 6 seconds later, with the label in place, the Pod was placed again with the right values. Without the gate, aws-node on those 2 nodes would have started with the defaults.
2026-12-03T12:02:02Z aws-node-jf744 1 running Bind plugin "DefaultBinder":
admission webhook "vpol.validate.kyverno.svc-fail-finegrained-aws-node-size-gate" denied the request:
Policy aws-node-size-gate failed: node ip-10-70-22-229.ap-northeast-2.compute.internal has no instance-size label yetWhen I replaced the 8 small nodes with the policy giving them WARM 1 / MIN 3, all 8 new nodes had annotations of WARM 1 / MIN 3, the gate denied nothing, and the nodes were Ready 27–33 seconds after the NodeClaim was created.
When I reran every script on December 4, 1 of the 8 new small nodes got WARM 4 / MIN 6 instead of WARM 1 / MIN 3, and the gate denied nothing. The mutation runs before the gate, and both read the Node with resource.Get(), so I think the size label arrived between the two reads: the mutation saw no size and used the default, and the gate then saw the label. Validating admission sees the object after mutation, so I added a second rule to the gate that compares the annotations on the Binding with the values for the node's size. To check the rule, I set the mutation to WARM 2 / MIN 3 and the gate to WARM 1 / MIN 3: the binding was denied 15 times, and once both said WARM 1 / MIN 3 the Pod was bound with WARM 1 / MIN 3 within 10 seconds. With the new rule, two more rounds of 8 new small nodes all got WARM 1 / MIN 3. The race didn't happen again in those rounds, so the rule never had to deny anything there.
2026-12-04T00:24:31Z aws-node-s88wr 15 running Bind plugin "DefaultBinder":
admission webhook "vpol.validate.kyverno.svc-fail-finegrained-aws-node-size-gate" denied the request:
Policy aws-node-size-gate failed: values on the binding do not match size large of node ip-10-70-23-216.ap-northeast-2.compute.internal| Method | New nodes | Result |
|---|---|---|
| Method 1 · One DaemonSet per size | 4 m6i.large | Only aws-node-large ran on each, Ready in 32–34 s. Fleet IPs the same as method 2 |
| Method 2 · Kyverno injection | About 20, all sizes | The gate denied 2 early bindings. In the rerun 1 of 8 got the defaults; with the value check in the gate, 16 of 16 got the right values |
Table 4. Test 1 · Per-size injection
The two methods differ on upgrades (Test 6 · Value change and upgrade).
04
The small-node setup was 1 m6i.4xlarge and 8 m6i.large, all launched fresh by Karpenter, with 3 regular Pods on each node. The large node kept WARM 4 / MIN 6 in both runs. Only the small nodes changed.
Figure 3. Subnet IPs with 3 regular Pods per node, as measured (m6i.4xlarge as the large node, m6i.large as the small node)
| Small-node values | IPs per small node | Subnet use per small node | 8 small nodes | All 9 nodes |
|---|---|---|---|---|
| WARM 4 / MIN 6, the same as the large node | 7 | 8 | 64 | 72 |
| WARM 1 / MIN 3, small nodes only | 4 | 5 | 40 | 48 |
Table 5. Test 2 · IP saving on small nodes. Each node used one ENI
The saving per node is the difference in max(MIN, Pods + WARM), so it depends on your current values and how many regular Pods run on each small node. With 3 Pods per node, WARM 3 / MIN 3 holds 6 IPs and WARM 2 / MIN 3 holds 5. IPs of Pods with security groups for Pods and the trunk ENIs do not depend on the warm values, so they don't change.
05
FailedCreatePodSandBox events, IPs the node holdsFewer spare IPs mean Pods wait when many start at once. On one small node I scaled regular Pods from 3 to 13 in one step, 2–3 runs per value.
| Small-node values | Of 10 new Pods, started at once | Last Pod Ready | Median |
|---|---|---|---|
| WARM 4 / MIN 6 | 4 | 16–32 s | 12–14 s |
| WARM 3 / MIN 3 | 3 | 29–43 s | 12–14 s |
| WARM 2 / MIN 3 | 2 | 29–54 s | 13–26 s |
| WARM 1 / MIN 3 | 1 | 65–83 s | 30–40 s |
Table 6. Test 3 · Pod start latency, regular Pods 3 → 13 on one m6i.large. Ranges cover the runs on December 3 and December 4
Every 5 seconds ipamd tops the pool back up to WARM spare IPs, and it doesn't count Pods that are waiting for an IP (datastoreTargetState()). So as many Pods as there are spare IPs start at once, and the rest start WARM at a time about 12 seconds apart. Waiting Pods show FailedCreatePodSandBox events until they get an IP.
Pods with security groups for Pods behave differently. On the same node, with ENABLE_POD_ENI=true and a SecurityGroupPolicy, I scaled SGPP Pods from 0 to 9.
| Small-node values | 9 SGPP Pods Ready | IPs the node holds |
|---|---|---|
| WARM 4 / MIN 6 | 2–3 s | 7 (unchanged) |
| WARM 1 / MIN 3 | 3–4 s | 4 (unchanged) |
Table 7. Test 3 · Pod start latency, SGPP Pods 0 → 9 on one m6i.large
SGPP Pods get their IP from a branch ENI that the VPC Resource Controller attaches, so the warm values don't matter. A deleted SGPP Pod's branch ENI stays for a 60-second cooldown by default (SGP config options). On a node at its branch ENI limit (9 on m6i.large), new SGPP Pods created right after deleting the old ones waited 62 seconds in the first run and 123–124 seconds in the rerun, with either value. If SGPP Pods are often deleted and recreated on small nodes, the branch ENI limit and this cooldown set the start time, not the warm values.
06
Method 2 depends on Kyverno answering when a node starts. I added a new node in three failure states. To make Kyverno unreachable, I changed the selector of the Kyverno Service so it had no endpoints while the webhook configuration stayed in place.
Figure 4. What happens to a new node's aws-node when Kyverno fails, as measured
| State | New node | After Kyverno was back |
|---|---|---|
| Unreachable · failurePolicy Fail | aws-node stayed Pending (15 bind failures in 2 minutes), node NotReady with cni plugin not initialized | Bound in 4 s, node Ready in 20 s, right values |
| Unreachable · failurePolicy Ignore | Node Ready at once, but aws-node had no annotations and used the defaults: 18 IPs with 3 Pods | Still the defaults 90 s later, until aws-node was restarted |
| Kyverno scaled to 0 replicas (Fail) | Same as Ignore: no annotations, 18 IPs | Still the defaults until aws-node was restarted |
Table 8. Test 4 · Kyverno failure
2026-12-03T12:36:41Z aws-node-g5s8w 15 running Bind plugin "DefaultBinder": Internal error occurred:
failed calling webhook "mpol.validate.kyverno.svc-fail-finegrained-aws-node-warm-ip":
failed to call webhook: Post "https://kyverno-svc.kyverno.svc:443/mpol/aws-node-warm-ip?timeout=10s":
no endpoints available for service ...With 0 replicas, Kyverno removed its own resource webhook configurations as it shut down, so the bindings went ahead without the policy even though the policy said Fail. In every case, Pods other than aws-node were scheduled as usual, because the webhook's matchConditions only send aws-node-* bindings in kube-system to Kyverno.
So with Fail, run Kyverno with high availability, because during a fallback nodes keep launching. With Ignore, or to cover a scale-down, add a check that finds aws-node Pods without the annotations and restarts them.
07
| Mistake | What happened |
|---|---|
| Fallback to a size not in the table (m6i.xlarge), no default rule | No annotations, so the env was an empty string and ipamd used the default WARM_ENI_TARGET=1: 28 IPs on 2 ENIs (subnet use 30) with 3 Pods. After adding a default of WARM 4 / MIN 6 and restarting aws-node, 7 IPs, but the 2 ENIs stayed (subnet use 9) |
| WARM 0 / MIN 0 | Treated as not set, as the README says, so back to the default: 13 IPs on 2 ENIs (subnet use 15) with 3 Pods. More, not fewer |
| WARM 0 / MIN 3 | Exactly 3 IPs with 3 Pods. Scaled to 13 Pods, the 10 new Pods got no IP for more than 5 minutes (DataStore has no available IP/Prefix addresses). After changing to WARM 1 / MIN 3 and restarting aws-node, all 13 were Running in 80 s |
Table 9. Test 5 · Value mistakes
The WARM 0 / MIN 3 case follows from how ipamd counts, as in Test 3: with WARM 0 there is never a spare IP, and waiting Pods are not counted, so the pool never grows past MIN. Keep WARM at 1 or more, and give the policy a default for sizes not in the table. A fix that tells an explicit 0 apart from an unset value is open as PR #3979 (not merged as of December 3, 2026).
08
kubectl apply, then with kubectl replace → the same with method 1I changed the small-node values from WARM 1 / MIN 3 to WARM 2 / MIN 3 and back while ping ran between Pods, then upgraded aws-node from v1.23.2 to v1.23.3 in two ways.
| Change | Method 1 · One DaemonSet per size | Method 2 · Kyverno injection |
|---|---|---|
| Change values | Changing the env rolls the DaemonSet by itself (9–17 s). New values within 20–30 s. Ping loss 0 | Nothing changes until aws-node restarts. rollout restart took 48 s for 10 nodes, new values within 30 s after. 0 of 750 pings lost, on the same node and across nodes |
Upgrade with kubectl apply -f aws-k8s-cni.yaml | The size-exclusion affinity on the original aws-node was removed. It then tried to start on every node (Pending on hostPort conflicts), the copies stayed on v1.23.2, and a new node got the default aws-node first | Only the image changed. The downward API env stayed, because it is in neither the upstream manifest nor the last-applied annotation |
Upgrade by replacing the whole manifest (kubectl replace -f) | Not tested | The downward API env was removed and every node went back to the default. Subnet use of 9 nodes went from 50 to 220 |
| After lowering values | IPs are returned, but an ENI that is already attached can stay, with its primary IP. After restoring the env above, the 9 nodes held 41 IPs but used 55 subnet IPs | |
Table 10. Test 6 · Value change and upgrade
The affinity was lost in method 1 because nodeSelectorTerms is an atomic list, so kubectl apply replaces it with the upstream one as a whole. With method 1, keep the affinity in the manifest you upgrade with. With method 2, keep the two downward API env entries in it.
09
aws-node reads the values from Pod annotations instead of fixed values:
- name: WARM_IP_TARGET
valueFrom:
fieldRef:
fieldPath: metadata.annotations['aws-vpc-cni/warm-ip-target']
- name: MINIMUM_IP_TARGET
valueFrom:
fieldRef:
fieldPath: metadata.annotations['aws-vpc-cni/minimum-ip-target']In this test Kyverno v1.20.0 rejected the older kyverno.io/v1 ClusterPolicy ("Kyverno v1.20 removed execution of legacy kyverno.io policy types and no longer accepts create or update requests for them"), so I wrote the two policies as CEL policies. The values below are the ones from Test 2 (large WARM 1 / MIN 3, other sizes WARM 4 / MIN 6). Replace the table with your sizes.
apiVersion: policies.kyverno.io/v1
kind: ValidatingPolicy
metadata: { name: aws-node-size-gate }
spec:
failurePolicy: Fail
validationActions: [Deny]
matchConstraints:
resourceRules:
- { apiGroups: [""], apiVersions: [v1], operations: [CREATE], resources: [pods/binding] }
matchConditions:
- name: aws-node-binding
expression: request.namespace == 'kube-system' && object.metadata.name.startsWith('aws-node-')
variables:
- { name: node, expression: 'resource.Get("v1", "nodes", "", object.target.name)' }
- { name: size, expression: "variables.node.metadata.?labels[?'karpenter.k8s.aws/instance-size'].orValue('')" }
- { name: nodegroup, expression: "variables.node.metadata.?labels[?'eks.amazonaws.com/nodegroup'].orValue('')" }
- { name: table, expression: '{"large": ["1", "3"], "4xlarge": ["4", "6"]}' }
- { name: v, expression: 'variables.table[?variables.size].orValue(["4", "6"])' }
validations:
- expression: variables.size != '' || variables.nodegroup != ''
messageExpression: "'node ' + object.target.name + ' has no instance-size label yet'"
- expression: >-
variables.size == '' || (
object.metadata.?annotations[?'aws-vpc-cni/warm-ip-target'].orValue('') == variables.v[0] &&
object.metadata.?annotations[?'aws-vpc-cni/minimum-ip-target'].orValue('') == variables.v[1])
messageExpression: "'values on the binding do not match size ' + variables.size + ' of node ' + object.target.name"
---
apiVersion: policies.kyverno.io/v1
kind: MutatingPolicy
metadata: { name: aws-node-warm-ip }
spec:
failurePolicy: Fail
matchConstraints:
resourceRules:
- { apiGroups: [""], apiVersions: [v1], operations: [CREATE], resources: [pods/binding] }
matchConditions:
- name: aws-node-binding
expression: request.namespace == 'kube-system' && object.metadata.name.startsWith('aws-node-')
variables:
- { name: node, expression: 'resource.Get("v1", "nodes", "", object.target.name)' }
- { name: size, expression: "variables.node.metadata.?labels[?'karpenter.k8s.aws/instance-size'].orValue('')" }
- { name: table, expression: '{"large": ["1", "3"], "4xlarge": ["4", "6"]}' }
- { name: v, expression: 'variables.table[?variables.size].orValue(["4", "6"])' }
mutations:
- patchType: ApplyConfiguration
applyConfiguration:
expression: >-
Object{metadata: Object.metadata{annotations: {
"aws-vpc-cni/warm-ip-target": variables.v[0],
"aws-vpc-cni/minimum-ip-target": variables.v[1]}}}The gate lets managed node group nodes through on the eks.amazonaws.com/nodegroup label, because they have no Karpenter size label. The orValue(["4", "6"]) is the default for sizes not in the table. The gate keeps the same table, so its second rule can deny a binding whose values don't match the node's size; keep the two tables in sync.
The policies read Nodes with resource.Get(). The default Kyverno install can't, and with failurePolicy Fail every aws-node binding was denied until I added this ClusterRole:
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: kyverno:admission-controller:read-nodes
labels:
rbac.kyverno.io/aggregate-to-admission-controller: "true"
rules:
- apiGroups: [""]
resources: ["nodes"]
verbs: ["get", "list", "watch"]After changing a value in the policy, restart aws-node with kubectl rollout restart ds/aws-node -n kube-system.
10
max(MIN, Pods + WARM) with your current values and the number of regular (non-SGPP) Pods on each small node. If the small nodes already run many Pods, the warm values change little.aws-node-* bindings in kube-system, so a policy failure can't block other Pods.11
The test used one cluster, one Region, and at most 14 nodes at a time. I did not check:
extraEnv route the #3630 comment uses), or installed and upgraded with its Helm chart. Whether an add-on update keeps the downward API env is unknown.ENABLE_PREFIX_DELEGATION), custom networking (ENIConfig), and IPv6 clustersThe Terraform configuration, Kubernetes manifests and scripts are in the blog repository under demos/vpc-cni-warmip-kyverno. The README maps each script's output to the tests above. I reran every script in the README's order on the test cluster on December 4, 2026 (UTC) and fixed what broke. The code creates billable resources (an EKS control plane, a NAT gateway, a t3.large node, and m6i nodes while tests run). When you are done, delete the test Pods and namespaces first so no ENIs are left behind, then run terraform destroy.
EKS에서 VPC CNI는 노드마다 Pod에 줄 IP를 미리 잡아 둡니다. 얼마나 잡을지는 aws-node DaemonSet의 WARM_IP_TARGET / MINIMUM_IP_TARGET 같은 환경 변수로 정하는데요, DaemonSet이 하나라서 클러스터의 모든 노드가 같은 값을 씁니다.
Cluster Autoscaler를 쓸 때는 이게 큰 문제가 아니었습니다. 노드 그룹 안의 인스턴스 타입은 CPU 코어 수와 메모리 양이 같아야 해서(Cluster Autoscaler AWS 문서) 노드 그룹마다 비슷한 크기를 묶어 썼고, 값 하나로도 대부분의 노드에 맞았거든요. Karpenter로 넘어오면서 NodePool 하나에 여러 크기를 열어 두고 그때 구할 수 있는 인스턴스로 노드를 띄우게 됐는데요, 큰 인스턴스를 못 구하면 작은 인스턴스 여러 대로 같은 용량을 채우는 식입니다. 그러면 노드 수가 늘어난 만큼 노드마다 잡아 두는 예비 IP도 같이 늘어납니다.
서브넷 IP가 빠듯하면 작은 노드만 값을 낮추고 싶어지는데, VPC CNI에는 아직 그런 기능이 없습니다. 이 기능 요청이 공개 이슈 #3630이고, 코멘트(2026년 5월 15일)에 Kyverno로 aws-node Pod에 값을 넣는 우회 방법이 소개돼 있습니다. Karpenter가 여러 크기를 섞어 띄우는 클러스터에서도 이 방법이 동작하는지, 운영할 때 어디서 막히는지는 나와 있지 않아서 직접 테스트해 봤습니다. 확인한 질문은 네 가지입니다.
Cluster Autoscaler에서 Karpenter로 옮기면서 인스턴스 크기를 넓혀 보려는 분들, #3630의 우회 방법을 운영에 넣어 볼지 고민 중인 분들께 도움이 될 것 같습니다. 테스트 코드도 함께 올려 두었습니다.
WARM_IP_TARGET과 MINIMUM_IP_TARGET을 주면 노드는 secondary IP를 max(MINIMUM_IP_TARGET, 사용 중인 Pod 수 + WARM_IP_TARGET)개 잡습니다. 값이 없으면 기본값 WARM_ENI_TARGET=1로 ENI 한 장 분량의 IP를 통째로 예비로 둡니다(VPC CNI README). 이 글의 측정값은 모두 이 식과 같았습니다. 아래에서 WARM은 WARM_IP_TARGET(비워 둘 예비 IP 수), MIN은 MINIMUM_IP_TARGET(최소로 잡아 둘 IP 수)인데요, "WARM 1 / MIN 3"은 WARM_IP_TARGET=1, MINIMUM_IP_TARGET=3이라는 뜻입니다.
값이 aws-node의 환경 변수라서, 크기별로 다른 값을 주는 방법은 두 가지입니다.
| 방법 | 동작 방식 |
|---|---|
| 방법 1 · DaemonSet 분리 | aws-node를 크기별로 복사(aws-node-large, aws-node-4xlarge)해서 값을 고정하고, 크기 label에 대한 node affinity로 나눕니다. 원래 aws-node는 그 크기를 제외(NotIn)하고 기본값을 둡니다 |
| 방법 2 · Kyverno 주입 | aws-node는 하나만 둡니다. aws-node Pod가 노드에 배치될 때(pods/binding) Kyverno가 노드의 karpenter.k8s.aws/instance-size label을 읽고 그 크기의 값을 annotation으로 붙입니다. API 서버가 Binding의 annotation을 Pod로 복사하고, aws-node는 downward API로 이걸 env로 읽습니다 |
표 1. 크기별 값을 넣는 두 가지 방법
그림 1. Kyverno로 aws-node에 크기별 값을 넣는 흐름(방법 2). 1 Karpenter가 노드를 띄우고 label을 붙임. 2 aws-node binding이 Kyverno로 감. 3 MutatingPolicy가 값을 annotation으로 붙임. 4 노드에 크기 label이 없거나 값이 크기와 맞지 않으면 gate가 거부하고 scheduler가 재시도. 5 API 서버가 Pod로 복사. 6 aws-node가 downward API로 읽음.
#3630 코멘트는 값을 노드 label에 적어 두고 Kyverno가 그 label을 aws-node Pod로 복사하는 방식이고, env는 EKS add-on의 extraEnv로 넣습니다. 그런데 Karpenter는 직접 정한 label을 NodePool 단위로 붙여서, 크기별 label을 쓰려면 크기마다 NodePool을 나눠야 합니다. 그래서 저는 값을 정책 안의 표로 두고 instance-size label로 골라 binding 때 넣도록 바꿨습니다. 방법 2에는 정책이 두 개 들어갑니다. 값을 붙이는 mutation과, 노드에 크기 label이 없거나 붙은 값이 노드 크기와 맞지 않으면 배치를 막는 gate입니다. 둘 다 kube-system의 aws-node-* binding에만 걸려서 다른 Pod는 이 정책의 영향을 받지 않습니다.
01
| 테스트 | 질문 | 한 일 | 결과 |
|---|---|---|---|
| 테스트 1 · 크기별 값 주입 | 새 노드마다 크기에 맞는 값이 들어가나 | 방법 1·2로 새 노드 약 20대를 띄우고 → aws-node가 받은 값과 gate 거부 횟수를 봄 | 평소에는 모두 맞는 값. 다시 돌릴 때 8대 중 1대가 기본값이었고, gate에 값 확인을 더한 뒤 16대 모두 맞음 |
| 테스트 2 · 작은 노드 IP 절감 | 작은 노드만 낮추면 IP가 얼마나 줄어드나 | 작은 노드 8대에 일반 Pod 3개씩, 값 WARM 4 / MIN 6과 WARM 1 / MIN 3으로 → 서브넷 IP를 셈 | 서브넷 IP 64 → 40개 (노드당 7 → 4개) |
| 테스트 3 · Pod 시작 지연 | 그 대가로 Pod가 얼마나 늦게 뜨나 | 작은 노드 1대에서 일반 Pod 3 → 13개, SGPP Pod 0 → 9개 → Pod마다 Ready까지 시간을 잼 | WARM 1 / MIN 3이면 마지막 일반 Pod Ready까지 65~83초(WARM 4 / MIN 6은 16~32초). SGPP Pod는 두 값 모두 2~4초 |
| 테스트 4 · Kyverno 장애 | Kyverno가 장애일 때 새 노드는 어떻게 되나 | Kyverno 응답 불가(Fail, Ignore) 또는 replica 0에서 새 노드 1대 → 노드와 aws-node 상태를 봄 | Fail: Kyverno가 돌아올 때까지 노드 NotReady. Ignore와 replica 0: aws-node가 기본값으로 뜸 |
| 테스트 5 · 값 설정 실수 | 정책 값을 잘못 넣으면 어떻게 되나 | 기본값 없이 표에 없는 크기, 값 WARM 0 / MIN 0과 WARM 0 / MIN 3 → 노드가 잡은 IP와 IP를 못 받은 Pod를 셈 | 기본값이 없을 때와 WARM 0 / MIN 0은 기본값으로 돌아감. WARM 0 / MIN 3은 새 Pod 10개가 5분 넘게 IP를 못 받음 |
| 테스트 6 · 값 변경과 업그레이드 | 값을 바꾸거나 aws-node를 올려도 값이 남나 | ping을 돌리며 값 변경, v1.23.2 → v1.23.3을 kubectl apply와 kubectl replace로 업그레이드 | 값은 aws-node 재시작 뒤 반영, ping 손실 없음. replace는 값을 지움(방법 2), apply는 크기 분리를 지움(방법 1) |
표 2. 테스트 결과. 서울 리전(ap-northeast-2), 2026년 12월 2~4일, Amazon EKS 1.36, 직접 관리하는 VPC CNI v1.23.3, Karpenter v1.15.3, Kyverno v1.20.0
02
서울 리전에 Terraform으로 테스트용 클러스터를 따로 만들었습니다. EKS API 엔드포인트는 private으로만 열고 Session Manager 포트 포워딩으로 접속했구요. 아주 큰 인스턴스 대신 크기 비율만 살려서 줄였는데요, m6i.4xlarge가 큰 노드, m6i.large가 큰 노드를 못 구할 때 대신 띄우는 작은 노드 역할입니다. CPU로 8배 차이입니다.
| 구성 요소 | 설정 |
|---|---|
| 클러스터 | Amazon EKS 1.36, private API 엔드포인트, NAT gateway 1개. Kyverno와 Karpenter는 t3.large 1대짜리 관리형 노드 그룹에서 실행 |
| VPC CNI | v1.23.3, 직접 관리하는 aws-node DaemonSet(EKS add-on 아님). 테스트 중에 v1.23.4가 나왔는데, 이 글에서 다루는 함수는 바뀌지 않았습니다 |
| Karpenter | v1.15.3, NodePool 하나에 m6i.large, m6i.xlarge, m6i.4xlarge |
| Kyverno | v1.20.0(Helm chart 3.10.0), ValidatingPolicy(gate) 1개, MutatingPolicy(값) 1개 |
| 노드 | m6i.4xlarge: ENI 8장 × IPv4 30개. m6i.large: 3장 × 10개. m6i.xlarge: 4장 × 15개 |
| 워크로드 | pause Pod, 노드당 일반 Pod 3개 |
표 3. 구성 요소와 설정
IP 수는 EC2 API(ENI별 secondary IP), ipamd introspection API(Pod에 나눠 준 IP), ipamd 프로세스 환경 변수(/proc/<pid>/environ)에서 읽어서, aws-node가 실제로 어떤 값으로 돌았는지까지 확인했습니다. 서브넷 소비는 노드가 잡은 IP에 ENI마다 primary IP 1개를 더한 값입니다.
모든 테스트는 이 클러스터 하나에서 아래 순서로 차례로 돌렸습니다. 이어지는 섹션은 이 순서가 아니라 테스트 번호 순서입니다.
그림 2. 테스트 클러스터 하나에서 테스트를 돌린 순서. EC2 아이콘은 Karpenter가 새 노드를 띄운 단계입니다.
03
방법 2로 평소처럼 운영하는 동안 Karpenter가 띄운 노드 약 20대가 모두 크기에 맞는 값을 받았습니다. 다만 새 노드가 뜰 때 순서가 엇갈리는 경우가 있었는데요, 2대에서는 노드에 크기 label(instance-size)이 붙기 전에 aws-node Pod가 먼저 그 노드에 배치되려고 했습니다. 이때는 Kyverno가 노드 크기를 알 수 없어서 맞는 값을 넣을 수 없거든요. gate가 이 배치를 한 번 거부했고, 약 6초 뒤 label이 붙은 다음 다시 배치될 때 맞는 값이 들어갔습니다. gate가 없었다면 이 2대의 aws-node는 기본값으로 떴을 겁니다.
2026-12-03T12:02:02Z aws-node-jf744 1 running Bind plugin "DefaultBinder":
admission webhook "vpol.validate.kyverno.svc-fail-finegrained-aws-node-size-gate" denied the request:
Policy aws-node-size-gate failed: node ip-10-70-22-229.ap-northeast-2.compute.internal has no instance-size label yet작은 노드에 WARM 1 / MIN 3을 주는 정책을 넣은 상태로 작은 노드 8대를 새로 바꿔 띄웠을 때는 8대 모두 annotation이 WARM 1 / MIN 3이었고, gate가 막은 건은 없었고, NodeClaim을 만든 뒤 27~33초에 Ready가 됐습니다.
12월 4일에 스크립트를 모두 다시 돌렸을 때는 새 작은 노드 8대 중 1대가 WARM 1 / MIN 3이 아니라 WARM 4 / MIN 6으로 떴는데, gate는 한 번도 막지 않았습니다. mutation이 gate보다 먼저 실행되고 둘 다 resource.Get()으로 Node를 따로 읽으니까, 두 번 읽는 사이에 크기 label이 붙은 것으로 보입니다. mutation은 크기를 못 봐서 기본값을 넣었고, gate는 label을 봐서 통과시킨 거죠. validating admission은 mutation이 끝난 객체를 보기 때문에, gate에 Binding의 annotation이 노드 크기의 값과 같은지 비교하는 규칙을 하나 더 넣었습니다. 확인을 위해 mutation은 WARM 2 / MIN 3, gate는 WARM 1 / MIN 3으로 일부러 다르게 두었더니 binding이 15번 거부됐고, 둘을 WARM 1 / MIN 3으로 맞추자 10초 안에 WARM 1 / MIN 3으로 배치됐습니다. 새 규칙을 넣은 뒤 작은 노드 8대를 두 번 더 새로 띄웠을 때는 모두 WARM 1 / MIN 3이었습니다. 다만 이때는 경합이 다시 생기지 않아서 새 규칙이 실제로 막은 건은 없었습니다.
2026-12-04T00:24:31Z aws-node-s88wr 15 running Bind plugin "DefaultBinder":
admission webhook "vpol.validate.kyverno.svc-fail-finegrained-aws-node-size-gate" denied the request:
Policy aws-node-size-gate failed: values on the binding do not match size large of node ip-10-70-23-216.ap-northeast-2.compute.internal| 방법 | 새 노드 | 결과 |
|---|---|---|
| 방법 1 · DaemonSet 분리 | m6i.large 4대 | 4대 모두 aws-node-large만 뜨고 32~34초에 Ready. 전체 IP 수는 방법 2와 같음 |
| 방법 2 · Kyverno 주입 | 약 20대, 모든 크기 | 먼저 온 binding 2건은 gate가 막음. 다시 돌릴 때 8대 중 1대가 기본값, gate에 값 확인을 더한 뒤 16대 모두 맞는 값 |
표 4. 테스트 1 · 크기별 값 주입
두 방법의 차이는 업그레이드 때 납니다(테스트 6 · 값 변경과 업그레이드).
04
작은 노드로 채운 구성은 m6i.4xlarge 1대와 m6i.large 8대이고, 모두 Karpenter로 새로 띄웠습니다. 노드마다 일반 Pod는 3개입니다. 큰 노드는 두 번 모두 WARM 4 / MIN 6으로 두고 작은 노드 값만 바꿨습니다.
그림 3. 노드당 일반 Pod 3개일 때의 서브넷 IP, 측정값(큰 노드 역할 m6i.4xlarge, 작은 노드 역할 m6i.large)
| 작은 노드 값 | 작은 노드 1대가 잡은 IP | 작은 노드 1대 서브넷 소비 | 작은 노드 8대 | 전체 9대 |
|---|---|---|---|---|
| WARM 4 / MIN 6, 큰 노드와 같은 값 | 7 | 8 | 64 | 72 |
| WARM 1 / MIN 3, 작은 노드만 | 4 | 5 | 40 | 48 |
표 5. 테스트 2 · 작은 노드 IP 절감. 노드마다 ENI는 1장이었습니다
노드당 줄어드는 양은 max(MIN, Pod 수 + WARM)의 차이라서, 지금 쓰는 값과 작은 노드에 일반 Pod가 몇 개 뜨는지에 따라 달라집니다. 노드당 Pod 3개면 WARM 3 / MIN 3은 6개, WARM 2 / MIN 3은 5개를 잡습니다. Pod 보안 그룹을 쓰는 Pod의 IP와 trunk ENI는 warm 값과 관계없어서 그대로입니다.
05
FailedCreatePodSandBox 이벤트, 노드가 잡은 IP 수예비 IP가 적으면 한꺼번에 뜨는 Pod는 기다려야 합니다. 작은 노드 한 대에서 일반 Pod를 3개에서 13개로 한 번에 늘렸고, 값마다 2~3번씩 쟀습니다.
| 작은 노드 값 | 새 Pod 10개 중 바로 뜬 수 | 마지막 Pod Ready까지 | 중앙값 |
|---|---|---|---|
| WARM 4 / MIN 6 | 4 | 16~32초 | 12~14초 |
| WARM 3 / MIN 3 | 3 | 29~43초 | 12~14초 |
| WARM 2 / MIN 3 | 2 | 29~54초 | 13~26초 |
| WARM 1 / MIN 3 | 1 | 65~83초 | 30~40초 |
표 6. 테스트 3 · Pod 시작 지연, m6i.large 한 대에서 일반 Pod 3 → 13개. 12월 3일과 4일 두 번 측정한 범위입니다
ipamd는 5초마다 예비 IP를 WARM 개수만큼 다시 채우는데, IP를 기다리는 Pod 수는 세지 않습니다(datastoreTargetState()). 그래서 예비 IP 수만큼은 바로 뜨고, 나머지는 WARM 개수씩 약 12초 간격으로 뜹니다. 기다리는 Pod에는 IP를 받을 때까지 FailedCreatePodSandBox 이벤트가 찍힙니다.
Pod 보안 그룹을 쓰는 Pod는 다르게 동작합니다. 같은 노드에서 ENABLE_POD_ENI=true와 SecurityGroupPolicy를 넣고 SGPP Pod를 0개에서 9개로 늘렸습니다.
| 작은 노드 값 | SGPP Pod 9개 Ready까지 | 노드가 잡은 IP |
|---|---|---|
| WARM 4 / MIN 6 | 2~3초 | 7 (변화 없음) |
| WARM 1 / MIN 3 | 3~4초 | 4 (변화 없음) |
표 7. 테스트 3 · Pod 시작 지연, m6i.large 한 대에서 SGPP Pod 0 → 9개
SGPP Pod는 VPC Resource Controller가 붙여 주는 branch ENI로 IP를 받아서 warm 값과 관계가 없습니다. 다만 지운 SGPP Pod의 branch ENI는 기본 60초 cooldown 동안 남아 있습니다(SGP 설정 옵션). 그래서 branch ENI 한도가 찬 노드(m6i.large는 9개)에서 SGPP Pod를 지우자마자 새로 띄우면 두 값 모두 처음 측정에서는 62초, 다시 돌렸을 때는 123~124초를 기다렸습니다. 작은 노드에서 SGPP Pod 교체가 잦다면, 시작 시간을 정하는 건 warm 값이 아니라 branch ENI 한도와 이 cooldown입니다.
06
방법 2는 노드가 뜰 때 Kyverno가 응답해야 동작합니다. 그래서 장애 상태 세 가지에서 새 노드를 띄워 봤습니다. Kyverno 응답 불가는 webhook 설정은 그대로 두고 Kyverno Service의 selector를 바꿔 엔드포인트를 비우는 식으로 만들었습니다.
그림 4. Kyverno 장애 때 새 노드의 aws-node가 어떻게 되는지, 측정값
| 상태 | 새 노드 | Kyverno가 돌아온 뒤 |
|---|---|---|
| 응답 불가 · failurePolicy Fail | aws-node가 Pending(2분 동안 배치 실패 15회), 노드는 cni plugin not initialized로 NotReady | 4초 만에 배치, 20초 만에 노드 Ready, 값도 정상 |
| 응답 불가 · failurePolicy Ignore | 노드는 바로 Ready지만 aws-node에 annotation이 없어 기본값으로 뜸. Pod 3개에 IP 18개 | 90초 뒤에도 기본값 그대로. aws-node를 다시 띄울 때까지 유지 |
| Kyverno replica 0 (Fail) | Ignore와 같음. annotation 없음, IP 18개 | aws-node를 다시 띄울 때까지 기본값 그대로 |
표 8. 테스트 4 · Kyverno 장애
2026-12-03T12:36:41Z aws-node-g5s8w 15 running Bind plugin "DefaultBinder": Internal error occurred:
failed calling webhook "mpol.validate.kyverno.svc-fail-finegrained-aws-node-warm-ip":
failed to call webhook: Post "https://kyverno-svc.kyverno.svc:443/mpol/aws-node-warm-ip?timeout=10s":
no endpoints available for service ...replica를 0으로 내리면 Kyverno가 종료하면서 자기 resource webhook 설정을 지웁니다. 그래서 정책이 Fail이었는데도 binding이 정책 없이 진행됐습니다. 어느 경우든 aws-node가 아닌 Pod는 평소처럼 배치됐는데요, webhook의 matchConditions가 kube-system의 aws-node-* binding만 Kyverno로 보내기 때문입니다.
그래서 Fail로 쓴다면 Kyverno를 고가용성으로 운영해야 합니다. 작은 노드로 대신 채우는 동안에는 노드가 계속 뜨거든요. Ignore로 쓰거나, Kyverno가 내려가는 경우까지 대비하려면 annotation 없는 aws-node Pod를 찾아 다시 띄우는 감시를 따로 두는 게 좋습니다.
07
| 실수 | 결과 |
|---|---|
| 표에 없는 크기(m6i.xlarge)의 노드가 뜸, 기본값 규칙 없음 | annotation이 없어 env가 빈 문자열이 되고, ipamd는 기본값 WARM_ENI_TARGET=1로 동작. Pod 3개에 ENI 2장, IP 28개(서브넷 소비 30). 기본값 WARM 4 / MIN 6을 넣고 aws-node를 다시 띄우자 IP 7개가 됐지만 ENI 2장은 남음(서브넷 소비 9) |
| WARM 0 / MIN 0 | README 설명대로 값이 없는 것으로 처리돼 기본값으로 돌아감. Pod 3개에 ENI 2장, IP 13개(서브넷 소비 15). 오히려 늘어남 |
| WARM 0 / MIN 3 | Pod 3개일 때는 IP 3개로 정확. Pod를 13개로 늘리자 새 Pod 10개가 5분 넘게 IP를 못 받음(DataStore has no available IP/Prefix addresses). WARM 1 / MIN 3으로 바꾸고 aws-node를 다시 띄우자 80초 만에 13개 모두 Running |
표 9. 테스트 5 · 값 설정 실수
WARM 0 / MIN 3은 테스트 3에서 본 ipamd의 계산 방식 때문에 생기는 결과입니다. WARM이 0이면 예비 IP가 생기지 않고 기다리는 Pod도 세지 않으니, 노드가 잡는 IP가 MIN 위로 늘어나지 않거든요. WARM은 1 이상으로 두고, 표에 없는 크기를 받을 기본값을 정책에 꼭 넣어 두세요. 명시적인 0과 값 없음을 구분하는 수정은 PR #3979로 열려 있습니다(2026년 12월 3일 기준 미반영).
08
kubectl apply로, 이어서 kubectl replace로 v1.23.3 업그레이드 → 방법 1로 같은 방식Pod 사이에 ping을 돌리면서 작은 노드 값을 WARM 1 / MIN 3에서 WARM 2 / MIN 3으로 바꿨다가 되돌렸고, 이어서 aws-node를 v1.23.2에서 v1.23.3으로 두 가지 방식으로 올려 봤습니다.
| 변경 | 방법 1 · DaemonSet 분리 | 방법 2 · Kyverno 주입 |
|---|---|---|
| 값 바꾸기 | env를 바꾸면 DaemonSet이 스스로 rollout(9~17초). 20~30초 안에 새 값. ping 손실 0 | aws-node를 다시 띄우기 전에는 그대로. rollout restart가 노드 10대에 48초, 끝난 뒤 30초 안에 새 값. 같은 노드, 다른 노드 모두 ping 750개 중 손실 0 |
kubectl apply -f aws-k8s-cni.yaml로 업그레이드 | 원래 aws-node의 크기 제외 affinity가 지워짐. 원래 aws-node가 모든 노드에 뜨려다 hostPort 충돌로 Pending, 복사본은 v1.23.2 그대로, 새 노드에는 기본값 aws-node가 먼저 뜸 | 이미지만 바뀜. downward API env는 upstream 매니페스트와 last-applied annotation 어디에도 없어서 그대로 남음 |
매니페스트 통째로 덮어쓰기(kubectl replace -f)로 업그레이드 | 테스트 안 함 | downward API env가 사라져 모든 노드가 기본값으로 돌아감. 노드 9대의 서브넷 소비 50 → 220개 |
| 값을 줄인 뒤 | IP는 반납하지만 이미 붙은 ENI는 primary IP와 함께 남을 수 있음. 위에서 env를 되돌린 뒤 전체가 잡은 IP는 41개, 서브넷 소비는 55개 | |
표 10. 테스트 6 · 값 변경과 업그레이드
방법 1에서 affinity가 지워진 건 nodeSelectorTerms가 atomic 리스트라서, kubectl apply가 upstream 매니페스트의 값으로 통째로 바꾸기 때문입니다. 방법 1을 쓴다면 업그레이드용 매니페스트에 affinity를, 방법 2를 쓴다면 downward API env 두 개를 꼭 넣어 두세요.
09
aws-node는 고정 값 대신 Pod annotation에서 값을 읽게 바꿉니다.
- name: WARM_IP_TARGET
valueFrom:
fieldRef:
fieldPath: metadata.annotations['aws-vpc-cni/warm-ip-target']
- name: MINIMUM_IP_TARGET
valueFrom:
fieldRef:
fieldPath: metadata.annotations['aws-vpc-cni/minimum-ip-target']이번 테스트에서 Kyverno v1.20.0은 예전 kyverno.io/v1 ClusterPolicy 생성을 거부해서("Kyverno v1.20 removed execution of legacy kyverno.io policy types and no longer accepts create or update requests for them"), 정책 두 개를 CEL 정책으로 썼습니다. 아래 값은 테스트 2에서 쓴 값(large WARM 1 / MIN 3, 그 밖의 크기 WARM 4 / MIN 6)이니 표는 쓰시는 크기에 맞게 바꾸세요.
apiVersion: policies.kyverno.io/v1
kind: ValidatingPolicy
metadata: { name: aws-node-size-gate }
spec:
failurePolicy: Fail
validationActions: [Deny]
matchConstraints:
resourceRules:
- { apiGroups: [""], apiVersions: [v1], operations: [CREATE], resources: [pods/binding] }
matchConditions:
- name: aws-node-binding
expression: request.namespace == 'kube-system' && object.metadata.name.startsWith('aws-node-')
variables:
- { name: node, expression: 'resource.Get("v1", "nodes", "", object.target.name)' }
- { name: size, expression: "variables.node.metadata.?labels[?'karpenter.k8s.aws/instance-size'].orValue('')" }
- { name: nodegroup, expression: "variables.node.metadata.?labels[?'eks.amazonaws.com/nodegroup'].orValue('')" }
- { name: table, expression: '{"large": ["1", "3"], "4xlarge": ["4", "6"]}' }
- { name: v, expression: 'variables.table[?variables.size].orValue(["4", "6"])' }
validations:
- expression: variables.size != '' || variables.nodegroup != ''
messageExpression: "'node ' + object.target.name + ' has no instance-size label yet'"
- expression: >-
variables.size == '' || (
object.metadata.?annotations[?'aws-vpc-cni/warm-ip-target'].orValue('') == variables.v[0] &&
object.metadata.?annotations[?'aws-vpc-cni/minimum-ip-target'].orValue('') == variables.v[1])
messageExpression: "'values on the binding do not match size ' + variables.size + ' of node ' + object.target.name"
---
apiVersion: policies.kyverno.io/v1
kind: MutatingPolicy
metadata: { name: aws-node-warm-ip }
spec:
failurePolicy: Fail
matchConstraints:
resourceRules:
- { apiGroups: [""], apiVersions: [v1], operations: [CREATE], resources: [pods/binding] }
matchConditions:
- name: aws-node-binding
expression: request.namespace == 'kube-system' && object.metadata.name.startsWith('aws-node-')
variables:
- { name: node, expression: 'resource.Get("v1", "nodes", "", object.target.name)' }
- { name: size, expression: "variables.node.metadata.?labels[?'karpenter.k8s.aws/instance-size'].orValue('')" }
- { name: table, expression: '{"large": ["1", "3"], "4xlarge": ["4", "6"]}' }
- { name: v, expression: 'variables.table[?variables.size].orValue(["4", "6"])' }
mutations:
- patchType: ApplyConfiguration
applyConfiguration:
expression: >-
Object{metadata: Object.metadata{annotations: {
"aws-vpc-cni/warm-ip-target": variables.v[0],
"aws-vpc-cni/minimum-ip-target": variables.v[1]}}}관리형 노드 그룹 노드에는 Karpenter 크기 label이 없어서, gate는 eks.amazonaws.com/nodegroup label로 통과시킵니다. orValue(["4", "6"])가 표에 없는 크기의 기본값입니다. gate도 같은 표를 가지고 있어야 두 번째 규칙으로 값이 노드 크기와 맞지 않는 binding을 막을 수 있으니, 두 표를 항상 같이 고치세요.
정책이 resource.Get()으로 Node를 읽는데, Kyverno 기본 설치에는 그 권한이 없습니다. failurePolicy Fail 상태에서 aws-node binding이 전부 거부되다가, 아래 ClusterRole을 넣고 나서야 풀렸습니다.
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: kyverno:admission-controller:read-nodes
labels:
rbac.kyverno.io/aggregate-to-admission-controller: "true"
rules:
- apiGroups: [""]
resources: ["nodes"]
verbs: ["get", "list", "watch"]정책의 값을 바꾼 뒤에는 kubectl rollout restart ds/aws-node -n kube-system으로 aws-node를 다시 띄웁니다.
10
max(MIN, Pod 수 + WARM)을 먼저 계산해 보세요. 작은 노드에 Pod가 이미 많이 뜬다면 warm 값을 바꿔도 차이가 크지 않습니다.kube-system의 aws-node-* binding에만 걸어 두세요. 그래야 정책 장애가 다른 Pod 배치를 막지 않습니다.11
클러스터 하나, 리전 하나, 한 번에 최대 14대 노드로 테스트했습니다. 아래는 확인하지 않았습니다.
extraEnv 방식), 또는 Helm chart로 설치하고 업그레이드하는 경우. add-on 업데이트 때 downward API env가 남는지는 모릅니다.ENABLE_PREFIX_DELEGATION), custom networking(ENIConfig), IPv6 클러스터Terraform 구성, Kubernetes 매니페스트, 스크립트는 블로그 저장소의 demos/vpc-cni-warmip-kyverno에 있습니다. README에 스크립트 출력과 위 테스트의 대응표가 있구요, 2026년 12월 4일(UTC)에 README 순서대로 모든 스크립트를 테스트 클러스터에서 다시 돌렸고, 그때 찾은 문제는 고쳐 두었습니다. 비용이 나가는 리소스(EKS control plane, NAT gateway, t3.large 노드, 테스트 중에는 m6i 노드)를 만드니까, 다 쓰고 나면 ENI가 남지 않게 테스트 Pod와 네임스페이스부터 지운 뒤 terraform destroy를 실행하세요.