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 Nginx Ingresses Using Annotations

Updated on 2024-01-04 GMT+08:00

The nginx-ingress add-on in CCE uses the community chart and image. If the default add-on parameters cannot meet your demands, you can add annotations to define what you need, such as the default backend, timeout, and size of a request body.

This section describes common annotations used for creating an ingress of the Nginx type.

NOTE:
  • The key value of an annotation can only be a string. Other types (such as Boolean values or numeric values) must be enclosed in quotation marks (""), for example, "true", "false", and "100".
  • Nginx Ingress supports native annotations of the community. For details, see Annotations.

Ingress Type

Table 1 Ingress type annotations

Parameter

Type

Description

Supported Cluster Version

kubernetes.io/ingress.class

String

  • nginx: Nginx ingress is used.
  • cce: The self-developed ELB ingress is used.

This parameter is mandatory when an ingress is created by calling the API.

For clusters of v1.23 or later, use the parameter ingressClassName. For details, see Using kubectl to Create an Nginx Ingress.

Only clusters of v1.21 or earlier

For details about how to use the preceding annotations, see Using kubectl to Create an Nginx Ingress.

Configuring a Redirection Rule

Table 2 Redirection rule annotations

Parameter

Type

Description

nginx.ingress.kubernetes.io/permanent-redirect

String

Permanently redirects an access request to a target website (status code 301).

nginx.ingress.kubernetes.io/permanent-redirect-code

String

Changes the returned status code of a permanent redirection rule to a specified value.

nginx.ingress.kubernetes.io/temporal-redirect

String

Temporarily redirects an access request to a target website (status code 302).

nginx.ingress.kubernetes.io/ssl-redirect

Bool

Specifies whether an HTTP request can be redirected to HTTPS only through SSL. The default value is true when the Ingress contains an SSL certificate.

nginx.ingress.kubernetes.io/force-ssl-redirect

Bool

Indicates whether to forcibly redirect a request to HTTPS even if TLS is not enabled for the Ingress. When HTTP is used for access, the request is forcibly redirected (status code 308) to HTTPS.

Configuring a URL Rewriting Rule

Table 3 URL rewriting rule annotations

Parameter

Type

Description

nginx.ingress.kubernetes.io/rewrite-target

String

Target URI where the traffic must be redirected.

For details about the application scenarios, see Configuring URL Rewriting Rules for Nginx Ingresses.

Interconnecting with HTTPS Backend Services

Table 4 Annotations for interconnecting with HTTPS backend services

Parameter

Type

Description

nginx.ingress.kubernetes.io/backend-protocol

String

If this parameter is set to HTTPS, HTTPS is used to forward requests to the backend service container.

For details about the application scenarios, see Interconnecting Nginx Ingresses with HTTPS Backend Services.

Creating a Consistent Hashing Rule for Load Balancing

Table 5 Annotation of consistent hashing for load balancing

Parameter

Type

Description

nginx.ingress.kubernetes.io/upstream-hash-by

String

Enable consistent hashing for load balancing for backend servers. The parameter value can be an Nginx parameter, a text value, or any combination. For example:
  • nginx.ingress.kubernetes.io/upstream-hash-by: "$request_uri" indicates that requests are hashed based on the request URI.
  • nginx.ingress.kubernetes.io/upstream-hash-by: "$request_uri$host" indicates that requests are hashed based on the request URI and domain name.
  • nginx.ingress.kubernetes.io/upstream-hash-by: "${request_uri}-text-value" indicates that requests are hashed based on the request URI and text value.

For details about the application scenarios, see Nginx Ingresses Using Consistent Hashing for Load Balancing.

Customized Timeout Interval

Table 6 Customized timeout interval annotations

Parameter

Type

Description

nginx.ingress.kubernetes.io/proxy-connect-timeout

String

Customized connection timeout interval. You do not need to set the unit when setting the timeout interval. The default unit is second.

Example:

nginx.ingress.kubernetes.io/proxy-connect-timeout: '120'

Customizing Body Size

Table 7 Annotations of customizing body size

Parameter

Type

Description

nginx.ingress.kubernetes.io/proxy-body-size

String

When the body size in a request exceeds the upper limit, error 413 is returned to the client. You can use this parameter to adjust the upper limit of the body size.

Example:

nginx.ingress.kubernetes.io/proxy-body-size: 8m

Documentation

For details about annotation parameters supported by Nginx ingresses, see Annotations.

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