2
1

More than 3 years have passed since last update.

EKSでPrivate IPが足りなくなった場合の対処

Posted at

はじめに

ある日、EKSで新しいServiceを作ろうとしたところ、Subnet内に利用可能なPrivateIPが足りずに失敗した。

Warning  CreatingLoadBalancerFailed  7m12s  service-controller  Error creating load balancer (will retry): failed to ensure load balancer for service xxxxx: InvalidSubnet: Not enough IP space available in subnet-xxxxx. ELB requires at least 8 free IP addresses in each subnet.

このSubnetのサブネットマスクは255.255.255.0なので、256弱のPrivateIPが使えるはずであるが、各Node(m5.xlarge)に30のPrivateIPが割り当ていることが原因でPrivateIPが枯渇していた。

ENIの割り当て

ENIの割り当て方法については詳しくは以下を参照。

要は、NodeがClusterに追加された時にENIが一つ、その後ipamDがもう一つENIをアタッチする。今回のNodeはm5.xlargeなので、1ENI辺り15のIPを割り当てられるので、計30個のIPが割り当てられていた。

解決方法

WARM_ENI_TARGETWARM_IP_TARGET の適宜修正することで、事前に割り当てるPrivateIPの数を調整できる。詳しくは以下を参照。

WARM_ENI_TARGET は使っていない事前に確保しておくENIの数。WARM_IP_TARGETは使っていない事前に確保しておくIPの数。

更新方法

まず以下のようなファイルを生成する。ここでは仮にtmp.yamlとする。 WARM_IP_TARGET には設定したい値に変えてください。

spec:
  template:
    spec:
      containers:
        - name: aws-node
          env:
          - name: WARM_IP_TARGET
            value: "5"

以下のコマンドを実行。

$ kubectl patch daemonset -n kube-system aws-node --patch "$(cat tmp.yaml)"

参考

2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1