In static IP address mode, after a Pod in VPC-CNI mode is created and used, the network component will create the CRD object VpcIPClaim
with the same name as the Pod in the same namespace. This object describes the Pod's requirements for the IP address. The network component will then create the CRD object VpcIP
based on the object and associate it with the corresponding VpcIPClaim
. VpcIP
is the name of the actual IP address, indicating that an actual IP address is occupied.
You can run the following command to view IP address usage in the container subnet of the cluster:
kubectl get vip
For a Pod to which a non-static IP address is bound, VpcIPClaim
will be terminated and VpcIP
will be terminated and reclaimed after the Pod is terminated. For a Pod to which a static IP address is bound, VpcIPClaim
and VpcIP
will be retained after the Pod is terminated. After the Pod with the same name is started, it will use the VpcIP
associated with the VpcIPClaim
with the same name, so as to retain the IP address.
As the network component will look for available IP addresses based on VpcIP
during IP address allocation in the cluster, static IP addresses need to be reclaimed promptly if not used (the current default policy indicates never to reclaim); otherwise, IP addresses will be wasted, and no IP addresses will be available. This document describes reclaiming after expiration, manual reclaiming, and cascade reclaiming of an IP address.
On Creating a Cluster page, select VPC-CNI for Container Network Add-on and check Enable Support for Static Pod IP, as shown in the figure below:
Set IP Reclaiming Policy in Advanced Settings. You can set how many seconds after the Pod is terminated to reclaim the static IP address.
You can modify the existing clusters with the following method:
kubectl edit deploy tke-eni-ipamd -n kube-system
to modify the existing tke-eni-ipamd deployment.spec.template.spec.containers[0].args
or modify the launch parameter.- --claim-expired-duration=1h # You can enter a value that is not less than 5m
For an IP address that urgently needs to be reclaimed, you need to find its Pod and namespace before running the following command to manually reclaim it:
Note:You must make sure that the Pod of the IP address to be reclaimed has been terminated; otherwise, the Pod network will become unavailable.
kubectl delete vipc <podname> -n <namespace>
Currently, the static IP address is bound to a Pod, regardless of the specific workload (e.g., Deployment, Statefulset). After the Pod is terminated, it is uncertain when to reclaim the static IP address. TKE has implemented that the static IP address was deleted once the workload to which the Pod belongs was deleted.
You can enable cascade reclaiming by the following steps:
kubectl edit deploy tke-eni-ipamd -n kube-system
to modify the existing tke-eni-ipamd deployment.spec.template.spec.containers[0].args
.- --enable-ownerref
After the modification, ipamd will automatically restart and take effect. At that time, a new workload can implement the cascade deletion of the static IP, which is not supported for an existing workload.
After a node is added to a cluster, IPAMD will try binding an EIP from the subnet in the same AZ as the node (the subnet configured for IPAMD) to the node. If IPAMD becomes abnormal or it is not configured with a subnet in the same AZ as the node, IPAMD cannot allocate a secondary ENI to the node. In addition, if the current VPC uses more secondary ENIs than the upper limit, no secondary ENIs can be allocated to the node.
Run the following command for troubleshooting:
kubectl get event
event
displays ENILimit
, the quota is not appropriate. You can fix the problem by increasing the quota of ENIs for the VPC.The ENIs configured for the node cannot be bound, and the VIP associated with nec
failed to be attached. View nec
, and you can see that its status is empty.
Run the following command to view nec
:
kubectl get nec -o yaml
If the nec
status of the node is empty, the returned result will be as shown below:
Run the following command to view the VIP associated with nec
:
kubectl get vip -oyaml
If the command returns a success result, the VIP status is Attaching
. The error message is as shown below:
Currently, up to 1,000 ENIs can be bound to a VPC. To increase the quota, submit a ticket for application. The quota will take effect by region.
Apakah halaman ini membantu?