To deploy applications in TKE and use static pod IP addresses, you can use StatefulSets with static IP addresses. Tencent Cloud TKE supports this type of StatefulSets that create pods with IP addresses in an actual VPC instance assigned through ENIs. TKE’s VPC-CNI plugin assigns IP addresses that do not change after pods are restarted or migrated.
By using StatefulSets with static IP addresses, you can:
Note that when StatefulSets with static IP addresses are used, static IPs survive only within the lifecycle of their StatefulSets.
You have enabled the VPC-CNI mode for the cluster. For more information, see Enabling the VPC-CNI Mode for a Cluster.
apiVersion: apps/v1beta1 kind: StatefulSet metadata: annotations: tke.cloud.tencent.com/enable-static-ip: "true" name: busybox spec: serviceName: "busybox" replicas: 3 template: metadata: annotations: tke.cloud.tencent.com/networks: "tke-route-eni" labels: app: busybox spec: terminationGracePeriodSeconds: 0 containers: - name: busybox image: busybox command: ["sleep", "10000000000"] resources: requests: tke.cloud.tencent.com/eni-ip: "1" limits: tke.cloud.tencent.com/eni-ip: "1"