Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Situation Awareness
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive

Configuring a Static EIP for a Pod

Updated on 2025-02-18 GMT+08:00

Application Scenarios

In Cloud Native Network 2.0, static public IP addresses (EIPs) can be assigned to StatefulSets or pods created directly.

Constraints

  • You can configure a static EIP for a pod only in CCE Turbo clusters of the following versions:
    • v1.19: v1.19.16-r20 or later
    • v1.21: v1.21.10-r0 or later
    • v1.23: v1.23.8-r0 or later
    • v1.25: v1.25.3-r0 or later
    • v1.25 or later
  • The static EIP function must be enabled together with the function of automatically allocating an EIP for a pod. For details, see Configuring an EIP for a Pod.
  • Only StatefulSet pods or pods created directly can be bound with static EIPs. Deployments, DaemonSets, and other types of workloads cannot be bound with static EIPs.
  • After a static EIP is allocated, the EIP attributes cannot be modified through the pod within the EIP lifecycle (before the EIP expires or it is still being used by the pod).
  • Do not configure a static EIP for services that do not have specific requirements on pod EIPs. Otherwise, the pod rebuilding takes a longer time.

Configuring a Static EIP for a Pod

When creating a pod to be bound with a static IP address, configure the EIP annotation. Then, an EIP will be automatically allocated and bound to the pod.

The following uses a StatefulSet named nginx as an example. For details about annotations, see Table 1.

  • For an automatically allocated EIP with a dedicated bandwidth when you create a StatefulSet, you do not need to specify the bandwidth ID. The following shows an example:
    apiVersion: apps/v1
    kind: StatefulSet
    metadata:
      name: nginx
    spec:
      serviceName: nginx
      replicas: 3
      selector:
        matchLabels:
          app: nginx
      template:
        metadata:
          labels:
            app: nginx
          annotations:
            yangtse.io/static-eip: 'true'   # Static EIP bound to the pod
            yangtse.io/static-eip-expire-no-cascading: 'false'   # Deleting the EIP with the associated workload
            yangtse.io/static-eip-expire-duration: 5m   # Interval for reclaiming expired EIPs
            yangtse.io/pod-with-eip: 'true'   # An EIP will be automatically allocated when the pod is created.
            yangtse.io/eip-bandwidth-size: '5'    # EIP bandwidth
            yangtse.io/eip-network-type: 5_bgp    # EIP type
            yangtse.io/eip-charge-mode: bandwidth    # EIP billing mode
        spec:
          containers:
            - name: container-0
              image: nginx:alpine
              resources:
                limits:
                  cpu: 100m
                  memory: 200Mi
                requests:
                  cpu: 100m
                  memory: 200Mi
          imagePullSecrets:
            - name: default-secret
  • For an automatically allocated EIP with a shared bandwidth when you create a StatefulSet, you are required to specify the bandwidth ID. The following shows an example:
    apiVersion: apps/v1
    kind: StatefulSet
    metadata:
      name: nginx
    spec:
      serviceName: nginx
      replicas: 3
      selector:
        matchLabels:
          app: nginx
      template:
        metadata:
          labels:
            app: nginx
          annotations:
            yangtse.io/static-eip: 'true'   # Static EIP bound to the pod
            yangtse.io/pod-with-eip: 'true'   # An EIP will be automatically allocated when the pod is created.
            yangtse.io/eip-network-type: 5_bgp    # EIP type
            yangtse.io/eip-bandwidth-id: <eip_bandwidth_id>    # Shared bandwidth ID of the EIP
        spec:
          containers:
            - name: container-0
              image: nginx:alpine
              resources:
                limits:
                  cpu: 100m
                  memory: 200Mi
                requests:
                  cpu: 100m
                  memory: 200Mi
          imagePullSecrets:
            - name: default-secret
Table 1 Annotations of the pod's static EIP

Annotation

Mandatory

Default Value

Description

Value Range

yangtse.io/static-eip

Yes

false

Specifies whether to enable the static EIP of a pod. This function is supported only for StatefulSet pods or pods without ownerReferences. This function is disabled by default.

false or true

yangtse.io/static-eip-expire-duration

No

5m

Specifies the interval for reclaiming the expired static EIP after the pod with a static EIP is deleted.

The time format is Go time type, for example, 1h30m and 5m. For details, see Go time type.

yangtse.io/static-eip-expire-no-cascading

No

false

Specifies whether to disable cascading reclamation of StatefulSet workloads.

The default value is false, indicating that the corresponding static EIP will be deleted with the StatefulSet workload. If you want to retain the static EIP for a new StatefulSet with the same name during the interval for reclaiming the expired EIP, set the value to true.

false or true

Table 2 Annotations of an EIP with a dedicated bandwidth

Annotation

Mandatory

Default Value

Description

Value Range

yangtse.io/pod-with-eip

Yes

false

Whether to allocate an EIP with a pod and bind the EIP to the pod

false or true

yangtse.io/eip-bandwidth-size

No

5

Bandwidth, in Mbit/s

The value range varies depending on the region and bandwidth billing mode. For details, see the purchase page on the EIP console.

For example, in the AP-Singapore region, if an EIP is billed by bandwidth, the bandwidth ranges from 1 Mbit/s to 2000 Mbit/s; if an EIP is billed by traffic, the bandwidth ranges from 1 Mbit/s to 300 Mbit/s.

yangtse.io/eip-network-type

No

5_bgp

EIP type

The type varies depending on the region. For details, see the purchase page on the EIP console.

For example, the following options are available in in the AP-Singapore region:

  • 5_bgp: dynamic BGP

yangtse.io/eip-charge-mode

No

None

Billed by traffic or bandwidth

You are advised to configure this parameter. If this parameter is left blank, no billing mode is specified. In this case, the default value of the EIP API in the region is used.

  • bandwidth: billed by bandwidth
  • traffic: billed by traffic

yangtse.io/eip-bandwidth-name

No

Pod name

Bandwidth name

  • Enter 1 to 64 characters. Only letters, digits, hyphens (-), underscores (_), and periods (.) are allowed.
  • Minimum length: 1 character
  • Maximum length: 64 characters
Table 3 Annotations of an EIP with a shared bandwidth

Annotation

Mandatory

Default Value

Description

Value Range

yangtse.io/pod-with-eip

Yes

false

Whether to allocate an EIP with a pod and bind the EIP to the pod

false or true

yangtse.io/eip-network-type

No

5_bgp

EIP type

  • 5_bgp
  • 5_union
  • 5_sbgp

The specific type varies with regions. For details, see the EIP console.

yangtse.io/eip-bandwidth-id

Mandatory when a shared bandwidth is used

None

ID of an existing bandwidth

  • If this parameter is not specified, the EIP with a dedicated bandwidth is used by default. For details about how to configure parameters for an EIP with a dedicated bandwidth, see Table 1.
  • Only the yangtse.io/eip-network-type field can be specified concurrently, and this field is optional.

None

Deleting a Static EIP

After a pod is deleted, if another pod with the same name is created before the static EIP expires, the EIP can still be used. The static EIP is deleted only if there is no new pod with the name the same as that of the deleted pod before the EIP expires, or the function of deleting the EIP with the associated StatefulSet is enabled and the StatefulSet is deleted.

We use cookies to improve our site and your experience. By continuing to browse our site you accept our cookie policy. Find out more

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback